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 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器