| @@ -1,5 +1,6 @@ | ||
| 1 | -<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly. | |
| 1 | +<?php if ( ! defined( 'ABSPATH' ) ) { | |
| 2 | + die; } // Cannot access directly. | |
| 2 | 3 | /** |
| 3 | 4 | * |
| 4 | 5 | * Custom Walker for Nav Menu Edit |
| 5 | 6 | * |
| @@ -4,25 +5,22 @@ | ||
| 4 | 5 | * Custom Walker for Nav Menu Edit |
| 5 | 6 | * |
| 6 | 7 | * @since 1.0.0 |
| 7 | 8 | * @version 1.0.0 |
| 8 | - * | |
| 9 | 9 | */ |
| 10 | 10 | if ( ! class_exists( 'ADMINIFY_Walker_Nav_Menu_Edit' ) && class_exists( 'Walker_Nav_Menu_Edit' ) ) { |
| 11 | - class ADMINIFY_Walker_Nav_Menu_Edit extends Walker_Nav_Menu_Edit { | |
| 11 | + class ADMINIFY_Walker_Nav_Menu_Edit extends Walker_Nav_Menu_Edit { | |
| 12 | 12 | |
| 13 | - public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { | |
| 13 | + public function start_el( &$output, $item, $depth = 0, $args = [], $id = 0 ) { | |
| 14 | + $html = ''; | |
| 14 | 15 | |
| 15 | - $html = ''; | |
| 16 | + parent::start_el( $html, $item, $depth, $args, $id ); | |
| 16 | 17 | |
| 17 | - parent::start_el( $html, $item, $depth, $args, $id ); | |
| 18 | + ob_start(); | |
| 19 | + do_action( 'wp_nav_menu_item_custom_fields', $item->ID, $item, $depth, $args ); | |
| 20 | + $custom_fields = ob_get_clean(); | |
| 18 | 21 | |
| 19 | - ob_start(); | |
| 20 | - do_action( 'wp_nav_menu_item_custom_fields', $item->ID, $item, $depth, $args ); | |
| 21 | - $custom_fields = ob_get_clean(); | |
| 22 | + $output .= preg_replace( '/(?=<(fieldset|p)[^>]+class="[^"]*field-move)/', $custom_fields, $html ); | |
| 23 | + } | |
| 22 | 24 | |
| 23 | - $output .= preg_replace( '/(?=<(fieldset|p)[^>]+class="[^"]*field-move)/', $custom_fields, $html ); | |
| 24 | - | |
| 25 | - } | |
| 26 | - | |
| 27 | - } | |
| 25 | + } | |
| 28 | 26 | } |