[英]Editing a child theme in Magento
我通过将文件添加到C:\\ xampp \\ htdocs \\ magento \\ app \\ design \\ frontend \\ Magento \\ themename创建了一个子主题
在这里,我有一个theme.xml文件,一个registration.php文件,Web文件夹,媒体文件夹和一个Magento_Theme文件夹。
我的问题如下:
该子主题使用C:\\ xampp \\ htdocs \\ magento \\ vendor \\ magento \\ theme-frontend-blank结构。 对于我的主页,例如,我将如何更改头文件。 它具有顶部菜单,搜索和徽标。 我将如何重新安排呢? 甚至是首页。 我将如何为此进行新的布局,以使3/5常规内容的列和2/5最新产品的内容(例如)。
任何方向都很棒!
改变标题
覆盖徽标:将vendor\\magento\\module-theme\\view\\frontend\\templates\\html\\header.phtml
复制到app\\design\\frontend\\Magento\\themename\\Magento_Theme\\templates\\html\\header.phtml
并根据需要进行修改。
覆盖topmenu:将vendor\\magento\\module-theme\\view\\frontend\\templates\\html\\topmenu.phtml
到app\\design\\frontend\\Magento\\themename\\Magento_Theme\\templates\\html\\topmenu.phtml
并根据需要进行修改。
覆盖搜索框:有点不同。 将vendor\\magento\\module-search\\view\\frontend\\templates\\form.mini.phtml
到app\\design\\frontend\\Magento\\themename\\Magento_Search\\templates\\form.mini.phtml
并根据需要进行修改。
参考:
创建布局
使用以下内容创建文件app\\design\\frontend\\Magento\\themename\\Magento_Theme\\page_layout\\new-layout.xml
:
<?xml version="1.0" ?> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd"> <update handle="2columns-left"/> </layout>
使用以下内容创建文件app\\design\\frontend\\Magento\\themename\\Magento_Theme\\page_layout\\layouts.xml
:
<page_layouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd"> <layout id="new-layout"> <label translate="true">My New Layout</label> </layout> </page_layouts>
编写CSS文件以声明宽度:
.page-layout-new-layout .column.left { width: 60%; float: left; -ms-flex-order: 1; -webkit-order: 1; order: 1; } .page-layout-new-layout .column.main { width: 40%; float: right; -ms-flex-order: 2; -webkit-order: 2; order: 2; }
清除缓存
参考:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.