( ! ) 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.0002397408{main}( ).../index.php:0 20.0003399448require( '/home/andyinf/magnior.com/wp-blog-header.php' ).../index.php:17 31.524432992304require_once( '/home/andyinf/magnior.com/wp-includes/template-loader.php' ).../wp-blog-header.php:19 41.526833077712include( '/home/andyinf/magnior.com/wp-content/themes/ab-theme/single-knowledgebase.php' ).../template-loader.php:74 51.526833077712get_header( ).../single-knowledgebase.php:2 61.526933078088locate_template( ).../general-template.php:41 71.526933078184load_template( ).../template.php:647 81.527033098808require_once( '/home/andyinf/magnior.com/wp-content/themes/ab-theme/header.php' ).../template.php:688 91.528833109528get_the_excerpt( ).../header.php:40 101.528833109528apply_filters( ).../post-template.php:381 111.528833109928WP_Hook->apply_filters( ).../plugin.php:203 121.529033111432wp_trim_excerpt( ).../class-wp-hook.php:288 131.529033111432get_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