-
-
Save ibndawood/c8d68883a27984b8efad678369114b65 to your computer and use it in GitHub Desktop.
Front - Add Custom Icons to Icon Control
This file contains 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-toy\', | |
iconPath: \'https://madrasthemes.github.io/assets/front-support/toy.svg\' | |
} | |
iconsObj[ \'fgbCustomIcon2\' ] = { | |
prefix: \'fgb\', | |
iconName: \'custom-icon-clock\', | |
iconPath: \'https://madrasthemes.github.io/assets/front-support/clock.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