@@ -41,7 +41,7 @@ class WP_Bootstrap_Navwalker extends Walker_Nav_Menu {
4141 * @return void
4242 */
4343 public function start_lvl ( &$ output , $ depth = 0 , $ args = array () ) {
44- $ indent = str_repeat ( "\t" , $ depth );
44+ $ indent = str_repeat ( "\t" , $ depth );
4545 $ output .= "\n$ indent<ul role= \"menu \" class= \" dropdown-menu \" > \n" ;
4646 }
4747
@@ -79,10 +79,10 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0
7979 } elseif ( 0 === strcasecmp ( $ item ->attr_title , 'disabled ' ) ) {
8080 $ output .= $ indent . '<li role="presentation" class="disabled"><a href="#"> ' . esc_attr ( $ item ->title ) . '</a> ' ;
8181 } else {
82- $ value = '' ;
82+ $ value = '' ;
8383 $ class_names = $ value ;
84- $ classes = empty ( $ item ->classes ) ? array () : (array ) $ item ->classes ;
85- $ classes [] = 'menu-item- ' . $ item ->ID ;
84+ $ classes = empty ( $ item ->classes ) ? array () : (array ) $ item ->classes ;
85+ $ classes [] = 'menu-item- ' . $ item ->ID ;
8686 $ class_names = join ( ' ' , apply_filters ( 'nav_menu_css_class ' , array_filter ( $ classes ), $ item , $ args ) );
8787 if ( $ args ->has_children ) {
8888 $ class_names .= ' dropdown ' ;
@@ -91,33 +91,33 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0
9191 $ class_names .= ' active ' ;
9292 }
9393 $ class_names = $ class_names ? ' class=" ' . esc_attr ( $ class_names ) . '" ' : '' ;
94- $ id = apply_filters ( 'nav_menu_item_id ' , 'menu-item- ' . $ item ->ID , $ item , $ args );
95- $ id = $ id ? ' id=" ' . esc_attr ( $ id ) . '" ' : '' ;
96- $ output .= $ indent . '<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" ' . $ id . $ value . $ class_names . '> ' ;
97- $ atts = array ();
94+ $ id = apply_filters ( 'nav_menu_item_id ' , 'menu-item- ' . $ item ->ID , $ item , $ args );
95+ $ id = $ id ? ' id=" ' . esc_attr ( $ id ) . '" ' : '' ;
96+ $ output .= $ indent . '<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" ' . $ id . $ value . $ class_names . '> ' ;
97+ $ atts = array ();
9898
9999 if ( empty ( $ item ->attr_title ) ) {
100- $ atts ['title ' ] = ! empty ( $ item ->title ) ? strip_tags ( $ item ->title ) : '' ;
100+ $ atts ['title ' ] = ! empty ( $ item ->title ) ? strip_tags ( $ item ->title ) : '' ;
101101 } else {
102102 $ atts ['title ' ] = $ item ->attr_title ;
103103 }
104104
105105 $ atts ['target ' ] = ! empty ( $ item ->target ) ? $ item ->target : '' ;
106- $ atts ['rel ' ] = ! empty ( $ item ->xfn ) ? $ item ->xfn : '' ;
106+ $ atts ['rel ' ] = ! empty ( $ item ->xfn ) ? $ item ->xfn : '' ;
107107 // If item has_children add atts to a.
108108 if ( $ args ->has_children && 0 === $ depth ) {
109- $ atts ['href ' ] = '# ' ;
110- $ atts ['data-toggle ' ] = 'dropdown ' ;
111- $ atts ['class ' ] = 'dropdown-toggle ' ;
112- $ atts ['aria-haspopup ' ] = 'true ' ;
109+ $ atts ['href ' ] = '# ' ;
110+ $ atts ['data-toggle ' ] = 'dropdown ' ;
111+ $ atts ['class ' ] = 'dropdown-toggle ' ;
112+ $ atts ['aria-haspopup ' ] = 'true ' ;
113113 } else {
114114 $ atts ['href ' ] = ! empty ( $ item ->url ) ? $ item ->url : '' ;
115115 }
116- $ atts = apply_filters ( 'nav_menu_link_attributes ' , $ atts , $ item , $ args );
116+ $ atts = apply_filters ( 'nav_menu_link_attributes ' , $ atts , $ item , $ args );
117117 $ attributes = '' ;
118118 foreach ( $ atts as $ attr => $ value ) {
119119 if ( ! empty ( $ value ) ) {
120- $ value = ( 'href ' === $ attr ) ? esc_url ( $ value ) : esc_attr ( $ value );
120+ $ value = ( 'href ' === $ attr ) ? esc_url ( $ value ) : esc_attr ( $ value );
121121 $ attributes .= ' ' . $ attr . '=" ' . $ value . '" ' ;
122122 }
123123 }
@@ -143,7 +143,7 @@ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0
143143 $ item_output .= $ args ->link_before . apply_filters ( 'the_title ' , $ item ->title , $ item ->ID ) . $ args ->link_after ;
144144 $ item_output .= ( $ args ->has_children && 0 === $ depth ) ? ' <span class="caret"></span></a> ' : '</a> ' ;
145145 $ item_output .= $ args ->after ;
146- $ output .= apply_filters ( 'walker_nav_menu_start_el ' , $ item_output , $ item , $ depth , $ args );
146+ $ output .= apply_filters ( 'walker_nav_menu_start_el ' , $ item_output , $ item , $ depth , $ args );
147147 } // End if().
148148 }
149149
@@ -192,11 +192,11 @@ public static function fallback( $args ) {
192192 if ( current_user_can ( 'edit_theme_options ' ) ) {
193193
194194 /* Get Arguments. */
195- $ container = $ args ['container ' ];
196- $ container_id = $ args ['container_id ' ];
195+ $ container = $ args ['container ' ];
196+ $ container_id = $ args ['container_id ' ];
197197 $ container_class = $ args ['container_class ' ];
198- $ menu_class = $ args ['menu_class ' ];
199- $ menu_id = $ args ['menu_id ' ];
198+ $ menu_class = $ args ['menu_class ' ];
199+ $ menu_id = $ args ['menu_id ' ];
200200
201201 if ( $ container ) {
202202 echo '< ' . esc_attr ( $ container );
0 commit comments