Nav Menu and display post count

Yep, I’ve got the solution to this problem. You can retrieve number of child items right from menu_items retrieved by wp_get_nav_menu_items. This function retrieves a bunch of post objects containing info about ‘menu_item_parent’. Inside start_el function of Walker_Nav_Menu class, you can try the match agains $item->ID. This way: $locations = get_nav_menu_locations(); $menu = wp_get_nav_menu_object( $locations[‘primary’] … Read more

Replace menu tag with tag

It looks like the above can be achieved with the walker_nav_menu_start_el filter (see reference). <?php function edit_menu_item($item_output, $item) { if ( get_field( ‘dropdown’, $item) == ‘yes’ ) { return ‘<button>’.$item->title.'</button>’; } return $item_output; } add_filter(‘walker_nav_menu_start_el’,’edit_menu_item’, 10, 2); Credit goes to @s_ha_dum via this answer.

Custom menus created but does not show up in admin panel

I don’t think you need to initiate the menus again where register_nav_menus() itself is an initiator. Syntax: <?php register_nav_menu( ‘your-menu-handle’, ‘Your Menu Label’ ); ?> Copy the following code and Paste them into your functions.php without any function or add_action(), I hope it’ll work: register_nav_menus( array( ‘front_login_menu’ => __( ‘Front Login Menu location’), ‘top_front_general_menu’ => … Read more

html/bootstrap menu to wordpress with dropdown

Try this walker. Example usage: wp_nav_menu( [ ‘menu_class’ => ‘menu-horizontal text-left’, ‘container’ => ”, ‘depth’ => 2, ‘theme_location’ => ‘main-menu’, // You should have loaded the class-my-bs-walker-nav-menu.php file from // within the theme’s functions.php file. ‘walker’ => new My_BS_Walker_Nav_Menu, ] ); The walker is not intended as a “global” walker for any Bootstrap menus; instead, … Read more