( ! ) 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.0001397304{main}( ).../index.php:0 20.0001399344require( '/home/andyinf/magnior.com/wp-blog-header.php' ).../index.php:17 31.184933001840require_once( '/home/andyinf/magnior.com/wp-includes/template-loader.php' ).../wp-blog-header.php:19 41.186333087248include( '/home/andyinf/magnior.com/wp-content/themes/ab-theme/single-knowledgebase.php' ).../template-loader.php:74 51.186333087248get_header( ).../single-knowledgebase.php:2 61.186333087624locate_template( ).../general-template.php:41 71.186333087720load_template( ).../template.php:647 81.186533108344require_once( '/home/andyinf/magnior.com/wp-content/themes/ab-theme/header.php' ).../template.php:688 91.187633119088get_the_excerpt( ).../header.php:40 101.187633119088apply_filters( ).../post-template.php:381 111.187633119488WP_Hook->apply_filters( ).../plugin.php:203 121.187633120992wp_trim_excerpt( ).../class-wp-hook.php:288 131.187633120992get_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