Skip to content

Instantly share code, notes, and snippets.

@mototeam
Last active December 2, 2023 10:19
Show Gist options
  • Save mototeam/0072b6d064ae90afd15ecba8dfca366c to your computer and use it in GitHub Desktop.
Save mototeam/0072b6d064ae90afd15ecba8dfca366c to your computer and use it in GitHub Desktop.
<?php
/*
* Add font with icons to Getwid plugin.
* Use this code in functions.php or custom plugin.
*/
// add hook
add_action( 'getwid/icons-manager/init', 'my_theme_getwid_add_custom_icons' );
function my_theme_getwid_add_custom_icons( $manager ) {
// register new font
$custom_icons = [
// load icons list for visual editor from function
'icons' => my_theme_custom_icons_list(),
// or load icons list for visual editor from file
//'icons' => require( get_template_directory() . '/custom-icons-list.php' ),
'handle' => 'custom-icons',
'src' => get_template_directory_uri() . '/custom-icons.css',
'deps' => null,
'ver' => '1.0.0'
];
$manager->registerFont( 'custom-icons', $custom_icons );
}
function my_theme_custom_icons_list() {
return array(
'Custom Icons' => array(
'icon-class-1', // icon-1 css class
'icon-class-2', // icon-2 css class, etc.
)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment