Menu Not Showing on Mobile

Your menu on mobile have font color white. check the attached image below. go to your theme setting and then menu or mobile menu setting. change the color to #000 or black.

Creating Menu Links in a Custom Theme

If you’re not using the default menu manager then already following a bad practice. Without using the menu manager you can create menu the way you’re doing but I think get_permalink() will add some flexibility in this case or you can check the user contribution section of get_permalink(). There are some nice examples which might … Read more

Adding a custom taxonomy to “nav_menu_item”

This is not how you enable adding your taxonomy terms to menus. To do that you just set show_in_nav_menus to true when registering the taxonomy. You have it set to false. $args = array( ‘labels’ => $labels, ‘hierarchical’ => true, ‘public’ => true, ‘show_ui’ => true, ‘show_admin_column’ => true, ‘show_in_nav_menus’ => true, // This ‘show_tagcloud’ … Read more

how avoid the link of the current post in the menu in the sidebar?

you can try this code. the first filter is to customise the widget arguments and the second filter is in the menu generation. add_filter(“widget_nav_menu_args”, function ($nav_menu_args, $nav_menu, $args, $widget_instance) { $post = get_queried_object(); if (is_a($post, “WP_Post”)) { $nav_menu_args[“remove_post_in_widget”] = $post->ID; } return $nav_menu_args; }, 10, 4); add_filter(“wp_nav_menu_objects”, function ($sorted_menu_items, $args) { if (isset($args->remove_post_in_widget)) { foreach … Read more

Having trouble adding CSS class through menu to link

The problem is an incorrect implementation of a menu item custom class by Virtue theme. Two changes are required in themes/virtue/lib/nav.php file. Replace line 30: //$classes[] = $custom_class; with: $classes[] = $custom_class; Replace line 45: $icon = ! empty( $custom_class) ? ‘<i class=”‘. $custom_class . ‘”></i>’ : ”; with: $icon = ”; Note: to avoid … Read more

swap out only main menu for logged in users

You have the elements of the $args array from wp_nav_menu() available. You can use them with the wp_nav_menu_args filter. In your case you probably want to use theme_location or menu. Exemplary usage: add_filter( ‘wp_nav_menu_args’, ‘check_for_args_element’ ); function check_for_args_element( $args ) { if ( $args[ ‘theme_location’ ] == ‘main’ ) { // code } return $args; … Read more

add page to main menu (frontend)

In order to know what are locations provided by theme for menus: $locations = get_nav_menu_locations(); This command will return an associative array that has for keys the locations and for values the ids of menu assigned to that location. To know what pages are associated to a menu: $idmenu = $locations[‘main-menu’]; $menu = wp_get_nav_menu_object( $idmenu … Read more

Get Menus In Header.php FIle

If your question is about having WordPress CMS menus appear correctly, your code would be edited as follows: <div class=”collapse navbar-collapse nav-wil” id=”bs-example-navbar-collapse-1″> <div class=”top-menu”> <nav class=”menu menu–francisco”> <div class=”collapse navbar-collapse” id=”navbar-menu”> <?php $defaults = array( ‘theme_location’ => ‘top’, ‘container’ => ”, ‘menu_class’ => ‘nav navbar-nav menu__list’, ‘menu’ => ‘Header Menu’ ); wp_nav_menu($defaults); ?> </div> … Read more