( ! ) 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.0001397448{main}( ).../index.php:0 20.0002399488require( '/home/andyinf/magnior.com/wp-blog-header.php' ).../index.php:17 31.213332992344require_once( '/home/andyinf/magnior.com/wp-includes/template-loader.php' ).../wp-blog-header.php:19 41.215133077752include( '/home/andyinf/magnior.com/wp-content/themes/ab-theme/single-knowledgebase.php' ).../template-loader.php:74 51.215233077752get_header( ).../single-knowledgebase.php:2 61.215233078128locate_template( ).../general-template.php:41 71.215233078224load_template( ).../template.php:647 81.215333098848require_once( '/home/andyinf/magnior.com/wp-content/themes/ab-theme/header.php' ).../template.php:688 91.216633109568get_the_excerpt( ).../header.php:40 101.216633109568apply_filters( ).../post-template.php:381 111.216633109968WP_Hook->apply_filters( ).../plugin.php:203 121.216633111472wp_trim_excerpt( ).../class-wp-hook.php:288 131.216633111472get_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