【问题标题】:Inheriting parent theme styles in a child theme on Wordpress Multisite在 Wordpress Multisite 上的子主题中继承父主题样式
【发布时间】:2015-12-14 19:54:34
【问题描述】:

我在多站点安装的 Wordpress 上使用子主题继承父主题样式时遇到问题。基本上,父主题是使用 FoundationPress 创建的,我编写了一个脚本来在创建新的多站点/博客时自动创建子主题。这可以正常工作并创建正确的styles.css 和我认为正确的functions.php 文件。我在子主题的functions.php中有以下内容:

wp_enqueue_style('first-stylesheet', get_template_directory_uri() . '/css/split/foundation_split_1.css', array(), AD_VERSION );

我遇到的问题是get_template_directory_uri() 正在返回附加了虚拟域的域,例如。 http://example.com/test-site/wp-cont... 这不是父主题样式表的正确 url(它应该是 http://example.com/wp-cont...)。

任何人都知道我做错了什么吗?这是我需要配置服务器端的重写吗?

谢谢

【问题讨论】:

    标签: php wordpress multisite


    【解决方案1】:

    啊,我错过了一些在我的 nginx 配置中重写的内容。对于任何有类似问题的人来说,关键线路是:

    if (!-e $request_filename) {
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;
        rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
        rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
    }
    

    【讨论】:

      猜你喜欢
      • 2013-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-13
      • 2018-04-16
      • 1970-01-01
      • 2015-09-29
      相关资源
      最近更新 更多