Embed Google Web Fonts

Robert Windisch edited this page Jul 25, 2015 · 1 revision

Deutsch / German

Clone this wiki locally

Go to the Google Web Fonts website and select an appropriate font. For this example we are selecting Yanone Kaffeesatz. Click on the font and under “Use this font” you can find the code to include in the document head. Do not forget to click on the desired options before.

Open your functions.php of your Childtheme. We are going to write a function, which is inserting the link in the head. In this function we are are copying the Google Code. After that we add the function to the hook xtreme_stylesheets.

function my_add_google_fonts() {

add_action('xtreme_stylesheets', 'my_add_google_fonts');

Open the file theme.css of your Childtheme. Here you can set, which elements should use this font. In our example we give all headlines the font Yanone Kaffeesatz :

h1, h2, h3, h4, h5, h6 { font-family: 'Yanone Kaffeesatz', arial, serif; }

That’s it!