[英]Cherry Framework “Font Awesome” issue on secure site
I am setting up an eCommerce site using a theme I bought off of Template Monster. 我正在使用从Template Monster购买的主题设置电子商务网站。 The child theme uses the Cherry Framework as the parent theme.
子主题使用Cherry框架作为父主题。
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. 我购买了SSL证书,并将其安装在服务器上,并通过.htaccess文件将所有非HTTPS请求重定向到HTTPS。
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.
罪魁祸首是Cherry框架,它通过“ http”源链接到Font Awesome源。
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. 我更新了该行代码以指向https源文件。
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. 我将更新后的文件通过FTP发送到服务器,然后覆盖了文件。
However, when I refresh the page, the source code shows that is it still linking to the file at the http source. 但是,当我刷新页面时,源代码显示它仍然链接到http源上的文件。
<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. 我没有安装任何Wordpress缓存插件。 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' />
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.
您可以更新样式引用以使用HTTPS,或者,如果您的项目由于防火墙限制等问题而无法到达netdna.bootstrapcdn.com,则可以在本地复制解决方案。
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' );
(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 ) (注意:这会在本地复制Font-Awesome,因此,将来要应用任何Font-Awesome更新,您将需要更新Font-Awesome的副本)
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' );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.