updated plugin Menu Icons
version 0.12.4
This commit is contained in:
@ -19,11 +19,18 @@ final class Menu_Icons_Picker {
|
||||
*/
|
||||
public static function init() {
|
||||
add_action( 'load-nav-menus.php', array( __CLASS__, '_load_nav_menus' ) );
|
||||
add_filter( 'wp_edit_nav_menu_walker', array( __CLASS__, '_filter_wp_edit_nav_menu_walker' ), 99 );
|
||||
add_filter( 'wp_nav_menu_item_custom_fields', array( __CLASS__, '_fields' ), 10, 4 );
|
||||
add_filter( 'manage_nav-menus_columns', array( __CLASS__, '_columns' ), 99 );
|
||||
add_action( 'wp_update_nav_menu_item', array( __CLASS__, '_save' ), 10, 3 );
|
||||
add_filter( 'icon_picker_type_props', array( __CLASS__, '_add_extra_type_props_data' ), 10, 3 );
|
||||
|
||||
if ( ! version_compare( get_bloginfo( 'version' ), '5.4', '>=' ) ) {
|
||||
add_filter(
|
||||
'wp_edit_nav_menu_walker', function() {
|
||||
return 'Menu_Item_Custom_Fields_Walker';
|
||||
}, 99
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,25 +47,6 @@ final class Menu_Icons_Picker {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Custom walker
|
||||
*
|
||||
* @since 0.3.0
|
||||
* @access protected
|
||||
* @wp_hook filter wp_edit_nav_menu_walker
|
||||
*/
|
||||
public static function _filter_wp_edit_nav_menu_walker( $walker ) {
|
||||
// Load menu item custom fields plugin
|
||||
if ( ! class_exists( 'Menu_Item_Custom_Fields_Walker' ) ) {
|
||||
require_once Menu_Icons::get( 'dir' ) . 'includes/library/menu-item-custom-fields/walker-nav-menu-edit.php';
|
||||
}
|
||||
$walker = 'Menu_Item_Custom_Fields_Walker';
|
||||
|
||||
return $walker;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get menu item setting fields
|
||||
*
|
||||
|
@ -55,6 +55,12 @@ final class Menu_Icons_Settings {
|
||||
* @since 0.3.0
|
||||
*/
|
||||
public static function init() {
|
||||
// Include Menu Icons for Block Editor
|
||||
if ( class_exists( '\ThemeIsle\GutenbergMenuIcons' ) ) {
|
||||
\ThemeIsle\GutenbergMenuIcons::instance();
|
||||
add_action( 'enqueue_block_assets', array( __CLASS__, '_enqueue_font_awesome' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow themes/plugins to override the default settings
|
||||
*
|
||||
@ -641,6 +647,21 @@ final class Menu_Icons_Settings {
|
||||
return $sections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts & styles for Block Icons
|
||||
*
|
||||
* @since 0.3.0
|
||||
* @wp_hook action enqueue_block_assets
|
||||
*/
|
||||
public static function _enqueue_font_awesome() {
|
||||
$url = Menu_Icons::get( 'url' );
|
||||
|
||||
wp_register_style(
|
||||
'font-awesome-5',
|
||||
"{$url}css/fontawesome/css/all.min.css"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts & styles for Appearance > Menus page
|
||||
*
|
||||
@ -690,7 +711,7 @@ final class Menu_Icons_Settings {
|
||||
$menu_current_theme = '';
|
||||
$theme = wp_get_theme();
|
||||
if ( ! empty( $theme ) ) {
|
||||
if ( is_child_theme() ) {
|
||||
if ( is_child_theme() && $theme->parent() ) {
|
||||
$menu_current_theme = $theme->parent()->get( 'Name' );
|
||||
} else {
|
||||
$menu_current_theme = $theme->get( 'Name' );
|
||||
|
Reference in New Issue
Block a user