Site logo

Archived topic

Generatepress adding font with sans-serif

1 reply · Started by jose on June 25, 2020

Viewing posts 1–2 of 2

I added a custom font with:

add_filter('generate_typography_default_fonts', function ($fonts) {
    $fonts[] = 'colaborate';
    return $fonts;
});

The font loads OK with @font-face css

My main issue is, how can i add sans-serif as secundary font while colaborate loads?

I have

body, button, input, select, textarea {
    font-family: "colaborate";
    font-weight: 100;
    font-size: 20px;
}

I want

body, button, input, select, textarea {
    font-family: "colaborate", sans-serif;
    font-weight: 100;
    font-size: 20px;
}

Hi there,

This is a flaw with the current typography system.

We'll be completely re-writing it in GP 2.6/GPP 1.12.

For now, the easiest workaround is to filter the "System Stack" value to be your custom font.

For example:

add_filter( 'generate_typography_system_stack', function() {
    return '"colaborate", sans-serif';
} );

Then choose "System Stack" in the Customizer to utilize your font.

It's 100% a "workaround", but it's the best option until that Typography revamp is ready to go.

This archived topic is closed to new replies.