Example #1
0
    /**
     * Load Google Fonts stylesheets
     *
     * @return void
     * @since 1.0.0
     */
    public function load_options_font() {
        $theme_options_fonts = yit_get_option_by( 'type', 'typography' );
        $google_fonts = yit_get_google_fonts();
        $google_fonts = array_map( 'stripslashes', ( array ) $google_fonts->items );

        foreach( $theme_options_fonts as $option ) {
            $option_value = yit_get_option( $option['id'] );


            if ( ! array_key_exists( 'family', $option_value ) ) {
                continue;
            }

            if( $option_value['family'] != $option['std']['family'] ) {
                $family = $option_value['family'];
            } else {
                $family = $option['std']['family'];
            }

            if( in_array( $family, $google_fonts ) ) {
                //yit_enqueue_style( 600, 'font-' . sanitize_title( preg_replace( '/:(.*)?/', '', $option['std']['family'] ) ), yit_ssl_url( '//fonts.googleapis.com/css?family=' . $option['std']['family'] ) );
                yit_add_google_font( $family );
            }
        }
    }
Example #2
0
 /**
  * Load Google Fonts stylesheets for the tab typography
  * 
  * @return void
  * @since 1.0.0
  */
 public function load_options_font()
 {
     $google_fonts = yit_get_google_fonts();
     $google_fonts = array_map('stripslashes', (array) $google_fonts->items);
     foreach ($this->_post_types as $post_type => $args) {
         foreach ($args['typography_options'] as $option) {
             $posts = $this->get_posts_types($post_type);
             foreach ($posts as $post) {
                 $family = $this->get_setting($option['id'], $post->ID);
                 if (isset($family['family']) && in_array($family['family'], $google_fonts)) {
                     //yit_enqueue_style( 800, 'font-' . sanitize_title( preg_replace( '/:(.*)?/', '', $family['family'] ) ), yit_ssl_url( 'http://fonts.googleapis.com/css?family=' . $family['family'] ) );
                     yit_add_google_font($family['family']);
                 }
             }
         }
     }
 }