Articles of navigation

Twenty Fifteen: Adjacent posts by menu_order

This question already has an answer here: Can the Next/Prev Post links be ordered by menu order or by a meta key? 7 answers

Search box as a menu item in the nav menu output by wp_nav_menu?

I am using the Twenty Twelve theme, and the following is the code it uses to register and display the menu. In functions.php: function twentytwelve_setup() { … // This theme uses wp_nav_menu() in one location. register_nav_menu( ‘primary’, __( ‘Primary Menu’, ‘twentytwelve’ ) ); … } add_action( ‘after_setup_theme’, ‘twentytwelve_setup’ ); In header.php: <nav class=”site-navigation main-navigation” role=”navigation”> […]

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 […]

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 […]

Replace menu permalink/hyperlink with only menu name/slug

I don’t know if i am asking this correctly, but i will try. I am doing this for history pushstate purpose. Code to get menu wihout ul and li: $topmenu= array( ‘container’ => false, ‘echo’ => false, ‘items_wrap’ => ‘%3$s’, ‘depth’ => 0 ); echo strip_tags(wp_nav_menu( $topmenu), ‘<a>’); At the moment, it gives mes only […]

How to have custom menu Item CSS Classes for wp_page_menu() or wp_list_pages()

I want to add custom classes to my menu items. For every subpage I show its siblings as a navigation: global $post; if ( is_page() && $post->post_parent ) { $args = array( ‘sort_column’ => ‘menu_order’, ‘title_li’ => ”, ‘child_of’=> $post->post_parent ); $childpages = wp_list_pages($args ); } This gives me a list with links. I want […]

Remove li from wp_nav_menu

How can I remove the li from wp_nav_menu? I know I can remove ul but is it also possible to remove the li? I would want to do this on just one menu not all the menus on my site.

Get only the path from a function like previous_post_link

I want to use something like previous_post_link(‘%link’,”,TRUE ) and put the path into a javascript variable. So using something like var previous = “<?php previous_post_link( ‘%link’,”,TRUE ); ?>”; outputs : <a href=”″ rel=”prev”></a> but instead I only want the path output in that variable. I like this function because it allows you to remain […]

.sub-menu or .children?

I’m developing a theme using a test installation (using InstantWP), but when I upload it to a staging site, for some reason the nav menu looks inflated. After looking at the source, it turned out to be that for some reason my test install uses the class .sub-menu while the staging install uses .children. Both […]