Note: All filters and functions described on this page should be placed inside your theme’s functions.php file.
Allow dynamic fonts
Via this filter you can turn off the ability to create new fonts via the customizer interface.
add_filter( 'novafonts_allow_dynamic_fonts', $bool );
$bool (bool) The boolean value. Set to false to prevent adding fonts via the customizer. True by default.
Filter default fonts
Filters the registered default and persistent fonts before they are rendered.
add_filter( 'novafonts_filter_default_fonts', $default_fonts );
$default_fonts (array) An array of the registered default and persistent fonts.
Filter font settings documentation URL
This filter allows you to change the URL for the link to the document mentioned within a font section’s description.
add_filter( 'novafonts_font_settings_docs_url', $url );
$url (string) The URL where the “See plugin documentation” link should link to. Links to https://novaplugins.com/docs/nova-fonts/font-settings/ by default.
Filter section description
Use this filter to manipulate the entire section description.
add_filter( 'novafonts_section_description', $desc );
$desc (string) The section description text.
Filter customizer panel title
Allows you to change the panel title from Nova Fonts to e.g. Typography.
add_filter( 'novafonts_customize_panel_title', $title );
$title (string) The title of the panel.
Filter customizer panel priority
This filter lets you modify the position of the panel within the customizer. Smaller numbers will position the panel higher up. Default is 160.
add_filter( 'novafonts_customize_panel_priority', $priority );
$priority (int) The priority of the panel.
Adding fonts programmatically
Use the following functions to modify what fonts are present by default.
novafonts_add_default_font( $args );
novafonts_add_persistent_font( $args );
- Default fonts are what you are offering to the user as a starting point when they use the plugin for the first time.
- Persistent, as the name implies, are fonts that are forced to be present at all times. The “removable” argument will always be set to false internally.
$args (array) Optional. Arguments to override the Nova_Font class property defaults.
$args = array();
$args['section_id'] = 'my-font-id';
$args['section_title'] = 'My Font';
$args['removable'] = true;
$args['renamable'] = true;
$args['default_values'] = array(
'css_selector' => '.site-title',
'font_source' => 'google',
'font_type' => 'monospace',
'font_family' => 'Space Mono',
'font_weight' => 400,
'text_transform' => 'uppercase',
'font_style' => 'italic',
'font_size' => 24,
'font_size_unit' => 'px',
'line_height' => 1.6,
'letter_spacing' => 0,
'letter_spacing_unit' => 'px',
'margin_top' => 0,
'margin_top_unit' => 'px',
'margin_bottom' => 0,
'margin_bottom_unit' => 'px',
'padding_top' => 0,
'padding_top_unit' => 'px',
'padding_bottom' => 0,
'padding_bottom_unit' => 'px',
);
$args['hidden_controls'] = array(
'css_selector',
'font_family',
'font_weight',
'text_transform',
'font_style',
'font_size',
'line_height',
'letter_spacing',
'padding_top',
'padding_bottom',
'margin_top',
'margin_bottom',
);