( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /home/andyinf/magnior.com/wp-includes/post-template.php on line 284 Call Stack #TimeMemoryFunctionLocation 10.0001398624{main}( ).../index.php:0 20.0002400664require( '/home/andyinf/magnior.com/wp-blog-header.php' ).../index.php:17 31.203432993896require_once( '/home/andyinf/magnior.com/wp-includes/template-loader.php' ).../wp-blog-header.php:19 41.206133079304include( '/home/andyinf/magnior.com/wp-content/themes/ab-theme/single-knowledgebase.php' ).../template-loader.php:74 51.206133079304get_header( ).../single-knowledgebase.php:2 61.206133079680locate_template( ).../general-template.php:41 71.206233079776load_template( ).../template.php:647 81.206533100400require_once( '/home/andyinf/magnior.com/wp-content/themes/ab-theme/header.php' ).../template.php:688 91.208433111120get_the_excerpt( ).../header.php:40 101.208433111120apply_filters( ).../post-template.php:381 111.208433111520WP_Hook->apply_filters( ).../plugin.php:203 121.208433113024wp_trim_excerpt( ).../class-wp-hook.php:288 131.208433113024get_the_content( ).../formatting.php:3337 " /> How To Use Custom Font – Magnior

How To Use Custom Font

The fonts on our themes are pulled from google fonts. In older themes we just enqueued them like this in your functions.php:

wp_enqueue_style('font_css','//fonts.googleapis.com/css?family=Roboto:100,100italic,400,400italic,700,700italic,500,500italic|Roboto+Condensed:400,400italic,500,600,700,700italic&subset=latin,latin-ext');

The url that you see with fonts is the same one that you get from google fonts. This is one way of using them in our themes. The second way of adding them is by adding this piece of code in your functions.php

/**
 * Google Fonts URL function
 *
 * Enqueues the google font that the site will use
 *
 * @since       1.0.0
 */
if ( ! function_exists( 'theme_name_fonts_url' ) ){
    function theme_name_fonts_url() {
        $fonts_url = '';
        // Translators: If there are characters in your language that are not supported by Google font, translate it to 'off'. Do not translate into your own language.
        $catamaran = _x( 'on', 'Roboto Text font: on or off', 'theme_name' );

        if ( 'off' !== $catamaran ) {
            $font_families = array();

            if ( 'off' !== $catamaran ) {
                $font_families[] = 'Roboto:400,300,700';
            }

            $query_args = array(
                'family' => urlencode( implode( '|', $font_families ) ),
                'subset' => urlencode( 'latin' ),
            );

            $fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' );
        }

        return esc_url_raw( $fonts_url );
    }
}

Or you can try to install Easy Google Fonts plugin. This plugin hasn’t been tested with our themes, so use it on your own risk.

Next article