Class Name:

MP_CORE_Font

Purpose:

To easily embed Google Fonts.

Overview:

This class will set up a font-face and assign a custom CSS Font Family name to any Google Font.

Usage:

 new MP_CORE_Font( $google_font_family_name, $custom_font_family_name );

Parameters:

  • $google_font_family_name (string)(required) – The Font Family name from Google Fonts. EG: ‘Merriweather Sans’
  • $custom_font_family_name (string)(optional) – The Font Family name you will use in your style.css file. EG: ‘My Font Family’. If blank, the font family will be the Google Font Family name.

Sample PHP Code:

function my_font(){ 

    new MP_CORE_Font( 'Merriweather Sans', 'My Font Family' );

}
add_action( 'wp', 'my_font' );

Sample CSS Code:


h1{
    font-family: 'My Font Family';
}