Okay
  Print

How to Add a New Font to the Right Way Theme

Note: We recommend using child themes when making adjustments to the core theme files. If you decide to use a child theme, copy the edited files into the child theme folder, preserving the original folder structure.

 Right way includes a collection of Google Fonts, which you can find in Appearance -> Theme Options -> Typography.

 


However, the list of available fonts can be expanded by adding new ones.

 

Adding a New Google Font

 If you want to add a new font from the Google Fonts library, open the theme-lists.php file in the  wp-content/themes/politics/includes directory.

 Find the getThemeFontsList () function, and locate the list of available fonts.

You'll see an array of Google fonts. Duplicate one of the font entries and replace the name of the font with your own. The line would look like this:

 $list['Cabin Condensed'] = array('family'=>'sans-serif');

 If in doubt, which name to pick, consult with the Google Fonts repository.

 After saving the file, go to the admin panel, and navigate to Appearance -> Fonts & Colors -> Fonts. Now your new font is available for all typography elements.

 

Adding a Custom Font

 1. In the css/font-face/ directory, create a new folder and give it a name of your font.

 2. The folder has to contain a @font-face kit, which would load your custom font on a webpage.

 The easiest way to create it is by using a webfont kit generator, such as Font Squirrel Generator (visit our tutorial to see how to use it).

   Extract the generated archive into /css/font-face/your-font-name.

 Important! Make sure that the name of your folder corresponds with the font-family value in the stylesheet.css.

 3. The only thing left now is to register your font name in theme-lists.php file located in wp-content/themes/politics/includes directory.

 Open up theme-lists.php and find a line with 'getCustomFontsList'. Add the name of your font preceded by comma.

 

Congratulations! Now if you go to the Appearance -> Fonts & Colors, you'll see your new typeface available among the other fonts.