Created
February 16, 2018 09:35
-
-
Save MjHead/8d5c7c56db822493b40df32011b2d24a to your computer and use it in GitHub Desktop.
Adding custom icon to icon control in Elementor
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 custom icon to icon control in Elementor | |
*/ | |
function jet_modify_controls( $controls_registry ) { | |
// Get existing icons | |
$icons = $controls_registry->get_control( 'icon' )->get_settings( 'options' ); | |
// Append new icons | |
$new_icons = array_merge( | |
array( | |
'new-icon-1-css-class' => 'icon 1', | |
'new-icon-2-css-class' => 'icon 2', | |
'new-icon-3-css-class' => 'icon 3', | |
), | |
$icons | |
); | |
// Then we set a new list of icons as the options of the icon control | |
$controls_registry->get_control( 'icon' )->set_settings( 'options', $new_icons ); | |
} | |
add_action( 'elementor/controls/controls_registered', 'jet_modify_controls', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment