Add custom Google Fonts to the WP customizer – Chipmunk

Add custom Google Fonts to the WP customizer

If predefined list of Google Fonts is not enough for you, it’s possible now to extend that with your own set of fonts.

Firstly, you need to activate the child theme that comes with the theme. Inside, you can find functions.php file where you should put the following snippet.

You can add as many fonts here as you need. Just make sure the names match those from the Google Fonts repository.

function chipmunk_custom_google_fonts( $fonts ) {
    $custom_fonts = array(
        'Open Sans'    => 'Open Sans',
        'Merriweather' => 'Merriweather',
    );

    return array_merge( $fonts, $custom_fonts );
}

add_filter( 'chipmunk_google_fonts', 'chipmunk_custom_google_fonts', 10, 1 );

This snippet requires Chipmunk theme 1.10 or newer to work properly.