0

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

1

3 Answers 3

0

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

0

Default.phtml file

<?php 
     $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
     $storeManager = $objectManager- 
     >get('Magento\Store\Model\StoreManagerInterface'); 
     $currentStore = $storeManager->getStore();
     $mediaUrl = $currentStore- 
     >getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
     $request = $objectManager->get('Magento\Framework\App\Action\Context')- 
     >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>
0

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;
            }
        }
    }
}

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.