Last active
June 18, 2019 11:15
-
-
Save yuliyang/5c9b754b72a623aef599b8bc2125f7ee to your computer and use it in GitHub Desktop.
[Elementor] Adding fonts to typography options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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