如何在magento 2.1中为不同的主题设置不同的徽标

时间:2017-08-10 10:57:25

标签: magento magento2

我有一个网站,针对不同的类别使用不同的主题。

我需要为每个主题设置不同的徽标,但在'内容>中设计>配置'只有商店前面使用徽标的选项。 因此,新上传的徽标将用于所有主题。

如何为每个主题使用特定的图像徽标?

1 个答案:

答案 0 :(得分:1)

请找到以下代码来管理不同主题的徽标 -

要声明主题徽标,请添加展开式<theme_dir>/Magento_Theme/layout/default.xml布局。

例如,如果您的徽标文件是my_logo.png,大小为300x300px,则需要按如下方式声明:

<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/my_logo.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>

声明徽标大小是可选的。

要了解有关主题布局的更多信息,请参阅网址:http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/theme-create.html