繁体   English   中英

如何在 magento 2.3.3 中创建自定义标头

[英]How to create custom header in magento 2.3.3

我正在 magento 2.3.3 中创建一个商店。我创建了一个自定义标题,但它没有显示在前端。 我已经完成了以下步骤来创建自定义标题; 1:在我的主题文件夹内的 magento_theme 文件夹中创建一个名为 customheader.phtml 的文件,即 myvendor/mytheme/Magento_Theme/html/customheader.phtml 2:我在我的 dafault.xml 文件中添加了以下代码

<referenceContainer name="header.container">
<block class="Magento\Framework\View\Element\Template" name="custom_header" as="custom_header" 
 template="Magento_Theme::html/customheader.phtml" />
    </referenceContainer>
 <move element="minicart" destination="custom_header"/>
    <move element="currency" destination="custom_header"/>
    <move element="logo" destination="custom_header"/>
    <move element="skip_to_content" destination="custom_header"/>
    <move element="header.links" destination="custom_header"/>
    <move element="my-account-link" destination="custom_header" />
    <move element="navigation.sections" destination="custom_header"/>
    <move element="top.search" destination="custom_header" after="navigation.sections"/>
    <move element="top.links" destination="custom_header" />
    <move element="store_language" destination="custom_header" />
    <move element="store_switcher" destination="custom_header" />

添加上述代码后,我执行了以下命令;

php bin/magento setup:upgrade && php bin/magento setup:static-content:deploy -f && php bin/magento cache:flush

我已经在网上搜索过,但没有运气。 请帮忙! 提前致谢

我认为你已经做了很好的实现,但只是忘记清除 root/generated/code 文件夹中的所有内容

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM