Add the “.current-menu-item” class to tag?
Add the “.current-menu-item” class to tag?
Add the “.current-menu-item” class to tag?
It means that the declaration of the start_lvl method in wp_bootstrap_navwalker should match the declaration of the method in Walker_Nav_Menu. It doesn’t. function start_lvl( &$output, $depth ) { VS. function start_lvl( &$output, $depth = 0, $args = array() ) { Make the arguments match exactly and you should be fine. And you should probably not … Read more
You could either extend the Walker_Nav_Menu walker class (i.e., the start_el function is sufficient, as already mentioned). Or you could hook in when the original output (i.e., the category) has been created. That would be the walker_nav_menu_start_el hook. For instance like so: function wpdev_139801_start_el( $item_output, $item ) { if ( isset( $item->object ) && $item->object … Read more
Override edit_custom_walker.php to conditionally show input depending on menu position
Solved it with generous help using join()… function start_el(&$output, $page, $depth = 0, $args = array(), $id = 0) { if ( $depth ) $indent = str_repeat(“\t”, $depth); else $indent=””; extract($args, EXTR_SKIP); $output .= $indent . ‘<li id=”item_’.$page->ID.'” class=”‘.join( ” “, get_post_class( “”, $page->ID )).'”><span>’.apply_filters( ‘the_title’, $page->post_title, $page->ID ).'</span>’; }
You could use conditional statements to show the children. Depending on what your using to categorize the pages… If you were using parent / children categories it would work something like this: <?php if ( in_category( ‘New Watches’ )) { // show new watches menu } elseif ( in_category( array( ‘Classic Watches’ ) )) { … Read more
Walker to add Bootstrap markup for wp_list_pages
That’s problem with your css. Add this in your style.css. ul.children { margin-left: 3em; }
At the end of your Navigation Walker you can just append to the $output like so: $output .= apply_filters( ‘walker_nav_menu_start_el’ , $item_output , $item , $depth , $args ); // This is before the ending list item: $output .= ‘<span>Inner Navigational Text</span>’; To get the post meta (I’m not familiar with ACF) you can use … Read more
I’ve got the filter just for you: nav_menu_css_class function wpse_175057_nav_menu_css_class( $classes, $item ) { if ( $item->type === ‘post_type’ && $class = get_post_meta( $item->object_id, ‘_icon’, true ) ) $classes[] = $class; return $classes; } add_filter( ‘nav_menu_css_class’, ‘wpse_175057_nav_menu_css_class’, 10, 2 );