4

I had created custom theme in Magento 2 and parent theme as Magento/blank. In my custom theme I have changed logo for my theme. I had declared the theme logo in the app/design/frontend/Prasan/Sanku/layout/default.xml

<?xml version="1.0" encoding="UTF-8"?>
<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_new.png</argument>
                <argument name="logo_img_width" xsi:type="number">300</argument>
                <argument name="logo_img_height" xsi:type="number">300</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

After writing this code I had cleared following files var/cache , var/generation, var/view_preprocessed and even pub/static/ but still the theme logo not changed.

I had uploaded logo_new.png at app/design/frontend/Prasan/Sanku/web/images/

2

2 Answers 2

5

We need to declare in

app/design/frontend/Prasan/Sanku/Magento_Theme/layout/default.xml

3
  • thanks Bilal Usean. its a small think i missed. thanks again. Jul 15, 2016 at 6:28
  • @PradeepSanku, you didn't miss anything. Magento's documentation is stated as your original question, but their documentation is wrong.
    – Brent
    May 4, 2017 at 20:26
  • Is it the same for Magento 2.3 ? May 20, 2020 at 11:16
0

Magento 2 uses an SVG logo by default, and it will find yours automatically if you put it in your theme directory at: web/images/logo.svg.

You may also need to specify the dimensions in: Magento_Theme/layout/default.xml.

Example:

   <body>
    <referenceBlock name="logo">
        <arguments>
            <!-- Set numbers as needed -->
            <argument name="logo_width" xsi:type="number">180</argument>
            <argument name="logo_height" xsi:type="number">75</argument>
        </arguments>
    </referenceBlock>
</body>

Your Answer

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

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