Articles of menus

next_post_link() on custom menu structure

In a blog, I am using next_post_link() and prev_post_link() extensively on posts. I also have a number of pages that I show in a WP3 menu. They are organized in topics and sub-topics e.g. like so: Home About – Subpage 1 – Subpage 2 – Subpage 3 Contact I would like to set up a […]

wp_nav_menu add some element to container

I’ve tried to hook wp_nav_menu_args to get an ID for the nav menu. I tried to add an element using javascript to container menu. But I never get the ID for the menu. How can I add an element to a nav menu container from: <nav id=”my-menu”><ul><li>…..<li></ul></nav> to: <nav id=”my-menu”><div class=”additional”></div><ul><li>…..<li></ul></nav>

Adding Custom “Current Menu Item” class to navigation?

I’m using the following code to force my wordpress navigation to reflect the category of the current post. It works perfectly, but I need help to extend this function to more than just 1 category and menu item. Tried duplicating the entire code but with different category and menu item but wordpress throws an “already […]

Add <span> within the <a> output of <? wp_nav_menu() ?>

Currently i am using: <?php echo wp_nav_menu( array( ‘menu’ => ‘main-menu’,’depth’=> 1,’items_wrap’ => ‘<ul class=”navigation_ul”>%3$s</ul>’ ) ); ?> I want to achieve: <ul class=”navigation_ul”> <li id=”menu_1″> <a href=”” class=”active”> <span class=”left_arrow”></span> <span class=”middle_text”>About Us</span> <span class=”right_arrow”></span> </a></li> <li id=”menu_2″> <a href=””> <span class=”left_arrow”></span> <span class=”middle_text”>Downloads</span> <span class=”right_arrow”></span> </a></li> <li id=”menu_3″> <a href=””> <span class=”left_arrow”></span> <span […]

Is there a way to add a class to non current menu item?

When using the wp_nav_menu function, the current menu item markup usually is like so: <li id=”menu-item-19″ class=”menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-8 current_page_item menu-item-19″> <a href=””>Page Name</a> </li> I’m wondering if there’s a way to add a class to the non current item on the menu when there’s an item selected. Something like non-current-menu-item. It […]

Custom menu output

If the menu is with Pages then how can I display the menu item links like this: I want to use the menu with Angular routes. I believe this can be done with a custom Walker.

wp_nav_menu not highlighting the current category when viewing a single post

My WordPress site has a bunch of posts, all filed by a top-level category and a bunch of subcategories therein. I have the main site nav rendering the category pages, which, when clicked, get all posts in that top-level category as an ‘archive’. The category highlights as you’d expect when you visit one of these […]

How to add a <span> tag to wp_nav_menu in a child theme

I’m creating a website with WordPress and Uncode theme, and I want to add a <span> tag to the primary menu in the child theme (in the ‘li’, after the ‘a’) and I don’t know how to do that. I don’t want to modify the parent theme, just add the ‘array’ ‘after’ in the wp_nav_menu […]

How to add wechat (weixin) link to navigation menu?

The profile link of WeChat (or Weixin) has the following format: weixin://contacts/profile/username As you can see, it doesn’t use http:// and that seems to be the reason that it cannot be added to the WordPress navigation menu. Well you can add it, but after saving the menu, the URL field is blank (again). The strangest […]

Change menu items URL

I create a single page website and use only anchors (#) on main menu items. Now, I need to include a second page on the website and keep the same menu. I’m using roots theme. Then, I’m building menu using: wp_nav_menu(array(‘theme_location’ => ‘primary_navigation’)); But how to change items url from, for example, #contact to […]