【问题标题】:Wordpress Plugin - change dynamic styles sheet to load under httpsWordpress 插件 - 更改动态样式表以在 https 下加载
【发布时间】:2017-04-19 01:33:35
【问题描述】:

我正在尝试将 foodpress 应用程序集成到我的多站点安装中。我目前安装了通配符 ssl。

当我在 chrome 中检查网站的首页时出现此错误。 foodpress_dynamic_styles.css 加载资源失败:服务器响应状态为 404(未找到)

我需要更改这部分代码,以便它加载 https 而不是 http,这样它才能正常工作。 (我会问开发人员,但他们说他们不再支持 wordpress。)

     public function register_fp_dynamic_styles(){
        $opt= $this->fpOpt;

        if(!empty($opt['fp_css_head']) && $opt['fp_css_head'] =='no' || 
     empty($opt['fp_css_head'])){
            if(is_multisite()) {
                $uploads = wp_upload_dir();
                wp_register_style('foodpress_dynamic_styles', $uploads['baseurl'] . '/foodpress_dynamic_styles.css', 'style');
            } else {
                wp_register_style('foodpress_dynamic_styles',
                    FP_URL. '/assets/css/foodpress_dynamic_styles.css', 'style');
            }
        }
    }

【问题讨论】:

    标签: php wordpress plugins


    【解决方案1】:

    您可以通过查找定义FP_URL 的代码将http 更改为https

    或者试试下面的代码以获得快速而肮脏的方法

      public function register_fp_dynamic_styles(){
                $opt= $this->fpOpt;
    
                if(!empty($opt['fp_css_head']) && $opt['fp_css_head'] =='no' || 
             empty($opt['fp_css_head'])){
                    if(is_multisite()) {
                        $uploads = wp_upload_dir();
                        wp_register_style('foodpress_dynamic_styles', $uploads['baseurl'] . '/foodpress_dynamic_styles.css', 'style');
                    } else {
        $httpsurl = str_replace("http:","https:",FP_URL. '/assets/css/foodpress_dynamic_styles.css';
        wp_register_style('foodpress_dynamic_styles',$httpsurl,'style');
                    }
                }
    

    【讨论】:

      猜你喜欢
      • 2014-03-12
      • 1970-01-01
      • 2011-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-16
      • 1970-01-01
      相关资源
      最近更新 更多