Php 如何覆盖magento 2主题';有我自己的自定义主题的phtml?
我正在尝试定制ultimo主题(尽管这可能适用于任何magento主题)。我创建了一个新的自定义主题(使用theme.xml),它使用Infortis/ultimo作为其父级 Ultimo的header.phtml具有以下路径Php 如何覆盖magento 2主题';有我自己的自定义主题的phtml?,php,magento,magento2,theming,Php,Magento,Magento2,Theming,我正在尝试定制ultimo主题(尽管这可能适用于任何magento主题)。我创建了一个新的自定义主题(使用theme.xml),它使用Infortis/ultimo作为其父级 Ultimo的header.phtml具有以下路径 ultimo/default/template/page/html/header.phtml 我已经尝试了许多不同的选项来覆盖我的主题-没有一个看起来有效,例如 frontend/my_theme/default/template/html/header.phtml f
ultimo/default/template/page/html/header.phtml
我已经尝试了许多不同的选项来覆盖我的主题-没有一个看起来有效,例如
frontend/my_theme/default/template/html/header.phtml
frontend/my_theme/default/template/page/html/header.phtml
有人有什么想法吗?使用主题路径覆盖模板
像
app/design////templates/your.phtml
似乎您正在使用Magnetor 1.X(根据您的参考代码)
app\design\frontend\my_theme\default\template\html\header.phtml
在Magento 1.X中
首先,您应该在后台配置新的包/主题
System -> Configuration -> Design -> Package = my_theme
Themes: default (no change should be necessary)
现在您可以修改文件header.phtml
app\design\frontend\my_theme\default\template\html\header.phtml
在Magento 2中
app\design\frontend\<VENDOR_NAME>\<THEME_NAME>\Magento_Theme\templates\html\header.phtml
app\design\frontend\\\Magento\u Theme\templates\html\header.phtml
在theme.xml中,您将父级设置为Infortis/ultimo
<parent>Infortis/ultimo</parent>
))
theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>New Custom</title>
<parent>Infortis/ultimo</parent>
<media>
<preview_image>media/preview.png</preview_image>
</media>
新习俗
Infortis/ultimo
媒体/预览.png
确保已从管理员处选择自定义主题作为当前主题,并且在此之后必须运行setup:upgrade命令。