Skip to content

Instantly share code, notes, and snippets.

@yuliyang
Last active June 18, 2019 11:15
Show Gist options
  • Save yuliyang/5c9b754b72a623aef599b8bc2125f7ee to your computer and use it in GitHub Desktop.
Save yuliyang/5c9b754b72a623aef599b8bc2125f7ee to your computer and use it in GitHub Desktop.
[Elementor] Adding fonts to typography options
<?php
/**
* Adding fonts to Elementor typography options
*/
function ching_add_fonts_elementor( $controls_registry ) {
// retrieve fonts list from Elementor
$fonts = $controls_registry->get_control( 'font' )->get_settings( 'options' );
// add your new custom font
$new_fonts = array_merge( [ 'Your Custom Font Family Name' => 'system' ], $fonts );
// return the new list of fonts
$controls_registry->get_control( 'font' )->set_settings( 'options', $new_fonts );
}
add_action( 'elementor/controls/controls_registered', 'ching_add_fonts_elementor', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment