Skip to content

Instantly share code, notes, and snippets.

@JoelEadeDesign
Created January 7, 2019 00:41
Show Gist options
  • Save JoelEadeDesign/fa50cb0ad30d1fd2b7a8d206a1f44f59 to your computer and use it in GitHub Desktop.
Save JoelEadeDesign/fa50cb0ad30d1fd2b7a8d206a1f44f59 to your computer and use it in GitHub Desktop.
Add Custom Font Names to Elementor & GeneratePress Font Family drop-down
/* ------------------------------------
/* CUSTOM FONTS
/* ------------------------------------ */
/* ELEMENTOR */
function modify_controls( $controls_registry ) {
// First we get the fonts setting of the font control
$fonts = $controls_registry->get_control( 'font' )->get_settings( 'options' );
// Then we append the custom font family in the list of the fonts we retrieved in the previous step
$new_fonts = array_merge( [ 'Biotif' => 'system' ], $fonts );
// Then we set a new list of fonts as the fonts setting of the font control
$controls_registry->get_control( 'font' )->set_settings( 'options', $new_fonts );
}
add_action( 'elementor/controls/controls_registered', 'modify_controls', 10, 1 );
/* GENERATEPRESS */
add_filter( 'generate_typography_default_fonts','jed_add_system_fonts' );
function jed_add_system_fonts( $fonts ) {
$fonts[] = 'Biotif';
return $fonts;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment