Skip to content

Instantly share code, notes, and snippets.

@JPKCom
Forked from blogjunkie/functions.php.php
Created April 3, 2023 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JPKCom/5b2827d0660e96e006be0cab6e529e55 to your computer and use it in GitHub Desktop.
Save JPKCom/5b2827d0660e96e006be0cab6e529e55 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