doubi1931 2014-02-18 16:55
浏览 57
已采纳

安全网站上的Cherry Framework“Font Awesome”问题

I am setting up an eCommerce site using a theme I bought off of Template Monster. The child theme uses the Cherry Framework as the parent theme.

I purchased an SSL cert and had it installed on my server and am redirecting all non-HTTPS requests to HTTPS via the .htaccess file.

All browsers are saying that insecure content is being loaded, and asks me if I want to proceed. The culprit being the Cherry Framework is linking to the Font Awesome source at an "http" source.

wp_enqueue_style( 'font-awesome', 'http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css', false, '3.2.1', 'all' );

The file that this piece of code is in is:

CherryFramework/includes/theme-scripts.php

function cherry_stylesheets() {
if ( CURRENT_THEME != 'cherry' ) {
    if ( file_exists( CHILD_DIR . '/main-style.css' ) ) {
        wp_enqueue_style( CURRENT_THEME, CHILD_URL . '/main-style.css', false, null, 'all' );
    }

    if ( file_exists( CHILD_DIR . '/includes/widgets/my-flickr-widget.php' ) ) {
        wp_register_style( 'prettyPhoto', PARENT_URL.'/css/prettyPhoto.css', false, '3.1.5', 'all' );
        wp_enqueue_style( 'prettyPhoto' );
    }
}
wp_enqueue_style( 'font-awesome', 'http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css', false, '3.2.1', 'all' );
wp_register_style( 'magnific-popup', PARENT_URL.'/css/magnific-popup.css', false, '0.9.3', 'all' );
wp_enqueue_style( 'magnific-popup' );
}
add_action('wp_enqueue_scripts', 'cherry_stylesheets');

I updated that line of code to point to the https source file.

wp_enqueue_style( 'font-awesome', 'https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css', false, '3.2.1', 'all' );

I FTP'd the updated file to the server, and it overwrites the file.

However, when I refresh the page, the source code shows that is it still linking to the file at the http source.

<link rel='stylesheet' id='font-awesome-css'  href='http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css?ver=3.2.1' type='text/css' media='all' />

I don't have any Wordpress caching plugins installed. I have also cleared my browser cache numerous times.

Anyone have any idea why the updated file will not render the correct source code?

<link rel='stylesheet' id='font-awesome-css'  href='https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css?ver=3.2.1' type='text/css' media='all' />
  • 写回答

1条回答 默认 最新

  • douke6881 2014-05-06 12:26
    关注

    To fix this problem, you have two choices. You can update the style reference to use HTTPS or you can copy the solution locally if you have a project that has issues reaching netdna.bootstrapcdn.com due to firewall restrictions for example.

    Solution 1:

    1. Deregister font-awesome from Parent theme via your child theme functions.php file as outlined below.
    function yourScriptsAndStyles() {  
        wp_deregister_style( 'font-awesome' );      
        wp_enqueue_style( 'font-awesome', 'https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css', false, '3.2.1', 'all' );   
    }  
    add_action( 'wp_enqueue_scripts', 'yourScriptsAndStyles' );  
    

    Solution 2:

    (NOTE: This copies Font-Awesome locally, so to apply any Font-Awesome updates in the future, you'll need to update your copy of Font-Awesome )

    1. Download a copy of font-awesome from http://fortawesome.github.io/Font-Awesome/
    2. Extract zip and into your child theme
    3. Deregister font-awesome from Parent theme via your child theme functions.php file as outlined below.
    function yourScriptsAndStyles() {  
        wp_deregister_style( 'font-awesome' );      
        wp_enqueue_style( 'font-awesome', get_stylesheet_directory_uri() . '/font-awesome-4.0.3/css/font-awesome.css', false, '4.0.3', 'all' );  
    }  
    add_action( 'wp_enqueue_scripts', 'yourScriptsAndStyles' );  
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?