Advertisement
KaisarAhmmed

Untitled

Jul 25th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.99 KB | None | 0 0
  1. <?php
  2.  
  3. $seo_body_font_get = cs_get_option('seo_body_font');
  4. $seo_heading_font_get = cs_get_option('seo_heading_font');
  5.  
  6. function seo_crazycreator_body_gf_url() {
  7.     $font_url = '';
  8.     $seo_body_font_get = cs_get_option('seo_body_font');
  9.  
  10.     if(!empty($seo_body_font_get)) {
  11.         $seo_body_font_get = cs_get_option('seo_body_font');
  12.     } else {
  13.         $seo_body_font_get = array();
  14.     }
  15.  
  16.  
  17.     if(array_key_exists('family', $seo_body_font_get)) {
  18.         $seo_body_font_get_family = $seo_body_font_get['family'];
  19.     } else {
  20.         $seo_body_font_get_family = 'Titillium Web';
  21.     }
  22.  
  23.     /*
  24.     Translators: If there are characters in your language that are not supported
  25.     by chosen font(s), translate this to 'off'. Do not translate into your own language.
  26.      */
  27.    
  28.     if ( 'off' !== _x( 'on', 'Google font: on or off', 'seo-crazycreator' ) ) {
  29.         $font_url = add_query_arg( 'family', urlencode( ''.$seo_body_font_get_family.':300,300i,400,400i,700,700i,900,900i&subset=latin,latin-ext' ), "//fonts.googleapis.com/css" );
  30.     }
  31.     return $font_url;
  32. }
  33.  
  34.  
  35. if($seo_heading_font_get['family'] == $seo_body_font_get['family']) {} else {
  36.     function seo_crazycreator_heading_gf_url() {
  37.         $font_url = '';
  38.         $seo_heading_font_get = cs_get_option('seo_heading_font');
  39.  
  40.         if(!empty($seo_heading_font_get)) {
  41.             $seo_heading_font_get = cs_get_option('seo_heading_font');
  42.         } else {
  43.             $seo_heading_font_get = array();
  44.         }
  45.  
  46.  
  47.         if(array_key_exists('family', $seo_heading_font_get)) {
  48.             $seo_heading_font_get_family = $seo_heading_font_get['family'];
  49.         } else {
  50.             $seo_heading_font_get_family = 'Titillium Web';
  51.         }
  52.        
  53.         /*
  54.         Translators: If there are characters in your language that are not supported
  55.         by chosen font(s), translate this to 'off'. Do not translate into your own language.
  56.          */
  57.        
  58.         if ( 'off' !== _x( 'on', 'Google font: on or off', 'seo-crazycreator' ) ) {
  59.             $font_url = add_query_arg( 'family', urlencode( ''.$seo_heading_font_get['family'].':300,300i,400,400i,700,700i,900,900i&subset=latin,latin-ext' ), "//fonts.googleapis.com/css" );
  60.         }
  61.         return $font_url;
  62.     }    
  63. }
  64. function seo_crazycreator_options_gf() {
  65.     wp_enqueue_style( 'seo-crazycreator-custom-google-fonts', seo_crazycreator_body_gf_url(), array(), '1.0.0' );
  66.    
  67.     $seo_body_font_get = cs_get_option('seo_body_font');
  68.     $seo_heading_font_get = cs_get_option('seo_heading_font');
  69.  
  70.     if($seo_heading_font_get['family'] == $seo_body_font_get['family']) {} else {
  71.         wp_enqueue_style( 'seo-crazycreator-google-heading-fonts', seo_crazycreator_heading_gf_url(), array(), '1.0.0' );
  72.     }
  73. }
  74. add_action( 'wp_enqueue_scripts', 'seo_crazycreator_options_gf' );
  75.  
  76.  
  77.  
  78.  
  79. if ( ! function_exists( 'seo_crazycrator_color_theme' ) ) :
  80.  
  81.     function seo_crazycrator_color_theme() {
  82.  
  83.         $seo_body_font             = cs_get_option('seo_body_font');
  84.         $seo_body_font_weight      = cs_get_option('seo_body_font_variant');
  85.  
  86.  
  87.         wp_enqueue_style(
  88.                 'seo-custom-style', get_template_directory_uri() . '/assets/css/custom-style.css'
  89.             );
  90.  
  91.         $custom_css = '';
  92.  
  93.  
  94.         if(!empty($seo_body_font)) {
  95.             $seo_body_font = cs_get_option('seo_body_font');
  96.         } else {
  97.             $seo_body_font = array();
  98.         }
  99.        
  100.         if(array_key_exists('family', $seo_body_font)) {
  101.             $seo_body_font_family = $seo_body_font['family'];
  102.         } else {
  103.             $seo_body_font_family = '';
  104.         }      
  105.  
  106.  
  107.         if(!empty($seo_body_font_family)){
  108.             $custom_css .= '
  109.                body{
  110.                    font-family: '.$seo_body_font_family.';
  111.                }
  112.            ';
  113.         }
  114.  
  115.  
  116.         wp_add_inline_style( 'seo-custom-style', $custom_css );
  117.     }
  118.  
  119.     add_action( 'wp_enqueue_scripts', 'seo_crazycrator_color_theme' );
  120.  
  121. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement