Skip to content

Instantly share code, notes, and snippets.

@blogjunkie
Created February 19, 2021 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save blogjunkie/321db0bcfa5a13355ac55583a6c86d48 to your computer and use it in GitHub Desktop.
Save blogjunkie/321db0bcfa5a13355ac55583a6c86d48 to your computer and use it in GitHub Desktop.
Add custom fonts to Elementor from your theme
<?php // Don't include this line
/**
* Add new font group (Custom) to the top of the list
*/
add_filter( 'elementor/fonts/groups', function( $font_groups ) {
$new_font_group = array( 'custom' => __( 'Custom' ) );
return array_merge( $new_font_group, $font_groups );
} );
/**
* Add fonts to the new font group
*/
add_filter( 'elementor/fonts/additional_fonts', function( $additional_fonts ) {
//Font name/font group
$additional_fonts['MyFont Font Family Name'] = 'custom';
$additional_fonts['MyFont Font Family Name2'] = 'custom';
return $additional_fonts;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment