Created
January 29, 2020 06:36
-
-
Save farookibrahim/01d32988d02b24105b09f489ecb85bd5 to your computer and use it in GitHub Desktop.
Front - Add Custom Icons to Icon Control
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
if( ! function_exists( 'front_child_icon_control_custom_icons' ) ) { | |
function front_child_icon_control_custom_icons() { | |
$icons_url = get_stylesheet_directory_uri() . '/assets/icons/'; | |
$custom_script = ' | |
var addFilter = wp.hooks.addFilter; | |
addFilter("frontgb.component.icon.control.fgb.icons", "front-child/icon-control-custom-icons", frontChildIconControlCustomIcons); | |
function frontChildIconControlCustomIcons(iconsObj) { | |
iconsObj[ \'fgbCustomIcon1\' ] = { | |
prefix: \'fgb\', | |
iconName: \'custom-icon-1\', | |
iconPath: \'' . $icons_url . 'custom-icon-1.svg\' | |
} | |
iconsObj[ \'fgbCustomIcon2\' ] = { | |
prefix: \'fgb\', | |
iconName: \'custom-icon-2\', | |
iconPath: \'' . $icons_url . 'custom-icon-2.svg\' | |
} | |
return iconsObj; | |
} | |
'; | |
wp_add_inline_script( 'wp-blocks', $custom_script ); | |
} | |
} | |
add_action( 'enqueue_block_editor_assets', 'front_child_icon_control_custom_icons', 99 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment