Google Web Fonts went strange
I have experienced a virtuemart page went very well in the development environment but after it went live, some fonts in the template went strange. That is because the live environment is https enabled and the template is hard code of the css files of Google Web Fonts in the page:
such as:
Code
<link href='http://fonts.googleapis.com/css?family=Oswald&v1' rel='stylesheet' type='text/css'> |
Well, that is not hard just two lines of PHP codes
Firstly, we should check whether they are in https site
Code
$httporhttps = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; |
Then, we change all font css reference like this:
Code
<link href='<?php echo $httporhttps; ?>fonts.googleapis.com/css?family=Oswald&v1' rel='stylesheet' type='text/css'> |
Finally, the fonts will display correctly
Trackback address for this post
Trackback URL (right click and copy shortcut/link location)
Feedback awaiting moderation
This post has 2 feedbacks awaiting moderation...
Form is loading...