[bug] https font bug – panel loading via http

Posted in: Newsmag
Post count: 9544

Hi folks
as you may or may not recall I had mentioned something about getting an http/https warning in the theme panel while playing with WooCommerce install.

I have traced this down to an http:// call for fonts in the theme. Since the store I’m setting up for our main business site is “https everywhere” … even with a local 301 redirect for any errant http elements, it turns out it’s a call to Google fonts for Roboto:

Mixed Content: The page at 'https://www.MYSITE.com/store/wp-admin/post.php?post=4&action=edit&message=1' was loaded over HTTPS, but requested an insecure stylesheet 'http://fonts.googleapis.com/css?family=Roboto+Condensed:300italic,400italic,700italic,400,300,700&subset=latin'. This request has been blocked; the content must be served over HTTPS.

In td_wp_booster_functions.php

I have this:

/*
* on demo and dev we load only the latin fonts
*
* modify this collection if you want to optimize the fonts loaded when you have the speed booster enabled
*
* collection url -> : http://www.google.com/fonts#ReviewPlace:refine/Collection:PT+Sans:400,700,400italic|Ubuntu:400,400italic|Open+Sans:400italic,400|Oswald:400,700|Roboto+Condensed:400italic,700italic,400,700
*/
wp_enqueue_style('google-font-rest', td_global::$http_or_https . '://fonts.googleapis.com/css?family=Roboto+Condensed:400italic,700italic,700,400|Open+Sans:400italic,600italic,700italic,400,700,600'); //used on menus/small text

and

// enqueue the fonts
if(!in_array('g_438', $td_user_fonts_list)) {//'g_438', //Open Sans
wp_enqueue_style('google-font-opensans', td_global::$http_or_https . '://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&subset=latin,cyrillic-ext,greek-ext,greek,vietnamese,latin-ext,cyrillic'); //used on menus/small text
}

if(!in_array('g_522', $td_user_fonts_list)) {//'g_522', //Roboto condensed
wp_enqueue_style('google-roboto-cond', td_global::$http_or_https . '://fonts.googleapis.com/css?family=Roboto+Condensed:300italic,400italic,700italic,400,300,700&subset=latin,cyrillic-ext,greek-ext,greek,vietnamese,latin-ext,cyrillic'); //used on content
}
}

So, apparently from the theme panel, it doesn’t pick up the https dynamically.

I’ve changed to:

wp_enqueue_style('google-font-rest', td_global::$http_or_https . 'https://fonts.googleapis.com/css?family=Roboto+Condensed:400italic,700italic,700,400|Open+Sans:400italic,600italic,700italic,400,700,600'); //used on menus/small text
} else {
$td_user_fonts_list = array();
$td_user_fonts_db = td_util::get_option('td_fonts');

if(!empty($td_user_fonts_db)) {
foreach($td_user_fonts_db as $td_font_setting_key => $td_font_setting_val) {
if(!empty($td_font_setting_val) and !empty($td_font_setting_val['font_family'])) {
$td_user_fonts_list[] = $td_font_setting_val['font_family'];
}
}
}

// enqueue the fonts
if(!in_array('g_438', $td_user_fonts_list)) {//'g_438', //Open Sans
wp_enqueue_style('google-font-opensans', td_global::$http_or_https . 'https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&subset=latin,cyrillic-ext,greek-ext,greek,vietnamese,latin-ext,cyrillic'); //used on menus/small text
}

if(!in_array('g_522', $td_user_fonts_list)) {//'g_522', //Roboto condensed
wp_enqueue_style('google-roboto-cond', td_global::$http_or_https . 'https://fonts.googleapis.com/css?family=Roboto+Condensed:300italic,400italic,700italic,400,300,700&subset=latin,cyrillic-ext,greek-ext,greek,vietnamese,latin-ext,cyrillic'); //used on content
}
}

***
but, that did not fix it.
***

Post count: 9544

Verified it’s a theme call, as I switched to Woo Canvas + Visual Composer, went to edit a page/post, and did NOT get the https warning.

If you could let me know which file might have that call for the admin section, so I can fix, would appreciate.

THIS ONLY IMPACTS ADMIN SCREENS, PAGES, POSTS, PRODUCTS … not live pages on web.

Thank you! ๐Ÿ™‚

  • This reply was modified 11 years by simchris.
Post count: 6600

Hi,

Please also try this after you also remove the td_global::$http_or_https . and lave just the 'https://fonts.googleapis.com/css?family=Roboto+Condensed:300italic,400italic,700italic,400,300,700&subset=latin,cyrillic-ext,greek-ext,greek,vietnamese ... like you’ve altered it but without the global http/https variable which also adds http or https. I have also highlighted here the part you need to remove: http://screencast.com/t/bORW39Ds
Please let me know if you still get this warning afterwards.

Thanks

Post count: 9544

Thanks will try this today ๐Ÿ™‚

Post count: 9544

Ha, yeah, stupid me. Removing the function to insert http or https would have been smart.

BTW; that fixed it. ๐Ÿ™‚

I’m guessing that function doesn’t work for roboto for some reason when used in the admin panel, even when loaded via https; so on page or post the “not all files secure” pops up. Super annoying on the visual editor stuff as you have to accept all to get stuff to load properly then it saves a draft of that.

So, minor fix for next time around.

I warned you I’d be acid-testing the WooCommerce stuff! (Sorry!) ๐Ÿ™‚

Post count: 1291

Hi,

We’ll look into it, there’s no problem ๐Ÿ™‚

Thank you, Emil G.

Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.