Advertisement
iEmanuele

HTTPS/SSL Fix

Mar 14th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. if ( ! function_exists( 'alterna_get_styles' ) ) :
  2. /**
  3.  * Get theme style path
  4.  */
  5. function alterna_get_styles($type = 'theme'){
  6.     $default_css;
  7.     $uploads = wp_upload_dir();
  8.     if($type == 'theme'){
  9.         $default_css = get_template_directory_uri().'/css/alterna.css';
  10.         if (file_exists($uploads['basedir'] . '/alterna/alterna-styles.css')) {
  11.             $default_css = $uploads['baseurl'] . '/alterna/alterna-styles.css';
  12.         }
  13.     }else if($type == 'woocommerce'){
  14.         $default_css = get_template_directory_uri().'/woocommerce/assets/css/woocommerce.css';
  15.         if (file_exists($uploads['basedir'] . '/alterna/alterna-woocommerce.css')) {
  16.             $default_css = $uploads['baseurl'] . '/alterna/alterna-woocommerce.css';
  17.         }
  18.     }
  19.  
  20.     if( !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ){
  21.         $default_css = str_replace( 'http://', 'https://', $default_css );
  22.     }
  23.  
  24.     return $default_css;
  25. }
  26. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement