Archived topic
add local font to generateblock dropdown
11 replies · Started by jasond on July 10, 2020
Hello
I already installed custom fonts into Customizer, how can I add it to Advanced Typography dropdown In GenerateBlocks without having to type the font name every time.
add_filter( 'generate_typography_default_fonts', function( $fonts ) {
$fonts[] = 'Custom Font';
return $fonts;
} );
Many thanks
Hi there,
As of right now there are no filters for that, but we'll definitely be adding one :)
Many thanks Tom, any ETA for this?
Not at the moment - will see if I can get it added in 1.2 :)
Is this already implemented?
Hi,
You can see the full changelog here.
https://generateblocks.com/generateblocks-1-2-0/
It doesn't seem to be implemented yet. We'll see if we can add it in after transitioning the rc to the official release.
Any news on this? I have version 1.3.3 but I can't see my installed custom font in the dropdown of Typography. When I manually type it in the box below Font Family it works but only on the front of the webpage, I can't see a preview while editing the page.
Hi there,
It's not possible to filter the quick select of font families yet.
However, it sounds like you're wanting that local font to preview in the editor. GenerateBlocks likely won't have an option for that (at least as of right now). Instead, you need to do something like this: https://generatepress.com/forums/topic/how-to-use-local-font-in-generateblocks-container/#post-1827167
Thanks Tom, that worked! Indeed I wanted the preview in the editor. The quick select would also be nice, but the preview is great ;-)
I think adding fonts in the Asset Library in GB Pro will be a thing soon :)
Hello,
Why not just adding a simple filter please ?
import {
applyFilters,
} from '@wordpress/hooks';
[...]
const fonts = applyFilters( 'generateblocks.editor.fonts', [
{ value: '', label: __( 'Select font', 'generateblocks' ) },
{ value: 'Arial', label: 'Arial' },
{ value: 'Helvetica', label: 'Helvetica' },
{ value: 'Times New Roman', label: 'Times New Roman' },
{ value: 'Georgia', label: 'Georgia' },
]);
Hi there,
Agreed - this needs a filter. Will implement in 1.5.0.
Thanks!