AnswerBun.com

How to add logo in cms_index_index.xml in magento 2.3.5

app/design/frontend/vendorname/themename/Magento_cms/layout/cms_index_index.xml

<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="logo">
        <arguments>
            <argument name="logo_file" xsi:type="string">images/logo-light.png</argument>
        </arguments>
    </referenceBlock>
</body>

but issue is magento backend side configuration add logo-light.png but cms page logo not visible
transpart logo visible

please thanks advance for help

Magento Asked on December 31, 2020

3 Answers

3 Answers

Default.phtml file

      <div class="header-left offset-md-4 col-md-4">
          <div class="logo-wrapper <?php echo $logo?"sticky-item":"sticky-item-hidden"  ?>">
              <?php echo $this->getChildHtml('logo') ?>
              <a href=""><img class="logo-light" src="<?php echo $mediaUrl.'wysiwyg/logo-light.png'; ?>" /></a>
          </div>
                
      </div>

_extend.less

.home-page-transparent-header {
.page-header {
    a.logo {
        img {
            display: none;
        }
    }
    &.navbar-fixed-top.keep-header {
        .header-left {
            margin: 0;
        }
        .logo-light {
            display: none;
        }
        a.logo {
            img {
                display: block;
            }
        }
    }
}

}

Answered by Ravindrasinh Zala on December 31, 2020

Default.phtml file

<?php 
     $objectManager = MagentoFrameworkAppObjectManager::getInstance();
     $storeManager = $objectManager- 
     >get('MagentoStoreModelStoreManagerInterface'); 
     $currentStore = $storeManager->getStore();
     $mediaUrl = $currentStore- 
     >getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_MEDIA);
     $request = $objectManager->get('MagentoFrameworkAppActionContext')- 
     >getRequest();

    //var_dump($request->getFullActionName());

?>

    <div class="header-left offset-md-4 col-md-4">
                <?php if ($request->getFullActionName() == 'cms_index_index'): ?>
                <div class="logo-wrapper <?php echo $logo?"sticky-item":"sticky-item-hidden"  ?>">
                    <?php echo $this->getChildHtml('logo') ?>
                </div>
                <?php else: ?>
                    <div class="logo-wrapper <?php echo $logo?"sticky-item":"sticky-item-hidden"  ?>">
                        <img src="<?php echo $mediaUrl.'wysiwyg/logo-dark.jpg'; ?>" />
                    </div>
                <?php endif; ?>
    </div>

Answered by Ravindrasinh Zala on December 31, 2020

If your image is not in SVG then just upload your image from admin panel

"Content > Configuration > Select Your Current Theme [edit] > Header > Logo Image"

Thanks

Answered by Nilesh Dubey on December 31, 2020

Add your own answers!

Related Questions

Magento bms/erp migration from 1.9.3.2 to 2.3.4

0  Asked on November 18, 2020 by sahil-khanna

 

Magento2 Page jumps to top when click Menu Icon on mobile

1  Asked on November 13, 2020 by jaydip-patel

     

WYSIWYG media directory contents removed

1  Asked on November 12, 2020 by tyler-v

       

Magento 2 hacked with script in hacked

4  Asked on October 25, 2020 by casey

 

Magento 2 How to check Price Type?

1  Asked on October 21, 2020 by jackson

   

Magento 2 : How to insert Price inclusive Tax?

3  Asked on October 11, 2020 by anastasia-di-paulo

   

How to create and use REST API for mobile app?

1  Asked on September 23, 2020 by gowri-shankar

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved.