【问题标题】:Magento 2 ignoring new themeMagento 2 忽略新主题
【发布时间】:2016-03-15 10:11:23
【问题描述】:

我正在尝试创建我的第一个 Magento 2 主题。

我在这里创建了一个新主题:

/app/design/frontend/MyComp/MyTheme/

我将空白主题从/vendor/magento/theme-frontend-blank/ 复制到MyTheme,然后我创建/编辑了各种文件as per the instructions here

在管理面板中,我进入了商店 > 配置 > 设计并将主题设置为 MyTheme

但是前端似乎没有使用我的新主题。

当我从管理面板启用模板路径提示时,前端显示所有文件都是从这里获取的 /vendor/magento/module-theme/view/frontend/templates/

谁能解释为什么 Magento 2 忽略了我的主题,以及我该如何解决这个问题?

非常感谢。

【问题讨论】:

    标签: magento magento2


    【解决方案1】:

    你配置的地方不对,配置后没有运行命令。

    创建主题后,您必须在管理员中进行配置:管理员 > 内容 > 配置 > 编辑“默认商店视图”http://prntscr.com/k5idnm,然后选择您的主题,然后选择“应用主题”。

    之后,运行:

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

    如果之后主题仍然无法正确显示,您可以备份并删除文件夹 pub/static/frontend,然后再次运行上述 2 个命令并在浏览器的主题选项卡中按 Ctrl + F5。

    【讨论】:

      【解决方案2】:

      更改主题后清除缓存,在控制台中运行命令:

      php bin/magento cache:flush 
      

      此外,如果您的主题中没有文件,Magento 将使用主题后备系统。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-05-15
        • 1970-01-01
        • 2019-09-15
        • 2018-05-19
        • 2018-09-16
        • 1970-01-01
        • 2011-10-02
        相关资源
        最近更新 更多