menu->term_id ) ) { return $menu; } $menu_library = Controllers_Libraries::get_current_library( $args->menu->term_id ); if ( ! $menu_library ) { return $menu; } wp_enqueue_style( 'wpmi-frontend' ); wp_enqueue_style( $menu_library->get_style_name() ); return $menu; } public function nav_menu_item_title( $title, $menu_item_id ) { $classes = array(); $wpmi = ''; $style = ''; $size = ''; $color = ''; $new_title = $title; if ( ! is_admin() && ! wp_doing_ajax() ) { if ( $wpmi = get_post_meta( $menu_item_id, WPMI_DB_KEY, true ) ) { if ( isset( $wpmi['icon'] ) && $wpmi['icon'] != '' ) { foreach ( $wpmi as $key => $value ) { if ( ! in_array( $key, array( 'icon', 'color' ) ) && $value != '' ) { $classes[] = "wpmi__{$key}-{$value}"; } if ( $key === 'icon' ) { $classes[] = $value; } } if ( ! empty( $wpmi['label'] ) ) { $title = ''; } if ( ! empty( $wpmi['size'] ) ) { $size = 'font-size:' . $wpmi['size'] . 'em;'; } if ( ! empty( $wpmi['color'] ) ) { $color = 'color:' . $wpmi['color']; } $style = ' style="' . $size . $color . '"'; $icon = ''; if ( isset( $wpmi['position'] ) && $wpmi['position'] == 'after' ) { $new_title = $title . $icon; } else { $new_title = $icon . $title; } } } } return apply_filters( 'wp_menu_icons_item_title', $new_title, $menu_item_id, $wpmi, $title ); } public static function instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } }