昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期日, 二月 23, 2020

[网站建设]A quick fix for WordPress Hestia theme insecure image warning

After replacing the header background image of Hestia theme. There appeared a security warning on Chrome browser. Then I noticed the background image is linked from HTTP. I believe this issue is caused by the HTTPS reserve proxy I used.  But on the other hand, the theme code should handle this case as I have set $_SERVER['HTTPS']='on';

To fix this problem, I use the following grep command to locate the file. 


[bash]
grep -r --include=*.php "header-filter" .
[/bash]

I found the code is in the following file.

./wp-content/themes/hestia/inc/views/front-page/class-hestia-big-title-section.php

Start from line 97. Update the original code as following: 

[php]
<div class="header-filter"
<?php
if ( ! empty( $big_title_background ) ) {
    $background = esc_url( $big_title_background );
    if (is_ssl()){
        $background = str_replace('http:', 'https:', $background);
    }
    echo 'style="background-image: url(' . $background . ')"';
}
?>
></div>

[/php]

Then problem solved.



--
Feng

没有评论:

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.