Navigation Menu is a theme feature introduced with Version 3.0. WordPress includes an easy to use mechanism for introducing customised navigation menus into a theme. In order to incorporate menu support into your theme, you need to add a few code segments to your theme files.

learn more… | top users | synonyms (6)

4
votes
1answer
13k views

Add custom menu item using wp_nav_menu_items filter

I have added a snippet to add a "Profile" link to my website navigation menu. My code: add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link'); function my_nav_menu_profile_link($menu) { ...
0
votes
1answer
39 views

Editing existing pre-created menus in PHP

Here's my pickle. I'm using a script to automatically create a fully pledged WordPress site. In this process new pages, etc are created automatically. I now need a way to add the newly created page(s) ...
-2
votes
3answers
47 views

Wrapping my <li>'s with <a>

Whats the most simple way to change my wp-menu generated output from <li><a href="">nav link</a></li> to <a href=""><li><li/></a>? Do I create an array ...
3
votes
1answer
42 views

Some nav-menu filters do nothing

So, I've been trying to write a plugin, and I need to use the 'nav_menu_link_attributes' filter. I tried adding the filter, but it didn't respond - at all. That is, I made it die mid-process once the ...
0
votes
1answer
1k views

Category menu that filters out empty categories

I'm trying to build a menu which can be administered from the menu editor, but gets filtered before being output. More specifically the menu contains Woocommerce product categories, organised into a ...
0
votes
1answer
1k views

How to get current page menu item name instead of full menu item list

I would like to build a menu structure where you can only see the menu item of the current page like on this web site http://www.bigspaceship.com/services/ I search around and I have the following ...
21
votes
4answers
17k views

Programmatically add a Navigation menu and menu items

Through API functions, I want to define a new Navigation menu, select it in the current theme, and then insert a few Pages as menu items. This is to be done for instance on a theme activation. ...
0
votes
0answers
38 views

Query/load only WooCommerce shop categories into a custom landing page?

I want to reuse the WooCommerce shop-categories in a custom grid landing page, but without the product images, as I am using custom images to make the grid wall. What is the best way to do this? ...
0
votes
1answer
68 views

Highlight parent if item from submenu is active

I have a menu, but when I go to the submenu page, the parent of this submenu is not highlighted. How to do this? When it doesn't have a submenu, it works fine: My menu structure is: <nav ...
0
votes
1answer
99 views

Keeping my Sub Menu open when hovering on its list items

I'm building a custom theme from scratch and I'm stuck on this dropdown styling. I am able to have the sub-menu appear when its containing <li> is hovered but when I go to transition my mouse ...
0
votes
1answer
67 views

Assign different category colours to different categories in the main menu

I have created a colour picker field with ACF which shows on every category page and allows the end user to assign a colour to each category. This is working well but I would like the categories on my ...
0
votes
0answers
15 views

Customer nav menu walker for post type and taxonomy archives

Walkers have the least documentation that I'm able to find, so I've come here to ask how to achieve placing items attached to categories as sub-menus. Let me explain: I have a simple menu that ...
0
votes
0answers
22 views

Show menu from plugin

I would like to include plugin menu into the theme. Did something like this: <?php add_action('after_setup_theme', 'my_load_plugin'); function my_load_plugin() { get_part( 'parts/menu', ...
0
votes
1answer
39 views

Multiple navigation menu in same location

Is it possible to have multiple menus in same location but on different pages. My pages are now: cars --car details --car specs motorbikes --motorbike dealers --map --contact Plus about 20 other ...
6
votes
6answers
13k views

Add Class to Specific Link in Custom Menu

I know you can add a class in the custom menu options, but it adds it to the LI before the A. I want to apply the class directly to this specific A rather then the whole LI. So instead of the output ...
0
votes
0answers
60 views

How to add mobile only, multi-level menu?

What is the Wordpress way to adding a second menu? Not in the backend but programatically; so that it gets activated only when screen size is certain width. basically two menus- one for full sized ...
18
votes
3answers
29k views

How to use wp_nav_menu to create a select menu dropdown?

I'm using the following inside the wp_nav_menu function to create a select dropdown menu where each menu item is an option in the select dropdown... 'items_wrap' => '<select>%3$s</select&...
0
votes
1answer
19 views

Menu's built in the edit theme view do not have active states set when on child pages

have a menu that is pulled in like this: <?php wp_nav_menu ( array('menu' => 'header') ) ?> I am using WooCommerce and when visiting /shop the shop link in the header has the class: ...
1
vote
2answers
1k views

Menu styling for last menu item

okay so I'm using the following code to get my links... <?php wp_nav_menu( array('theme_location' => 'primary', 'container' => '', 'menu_class' => 'mainnav') ); ?> This is my CSS for ...
0
votes
3answers
30 views

Cannot add home page url to menu with #

I am adding a #section as a custom link to my menu, because I want to scroll to that section when I click on that link. When I'm on the home page, this works fine (the section is on the home page), ...
2
votes
4answers
1k views

Creating “static” taxonomies to choose from, inside custom post type?

Alright, so i have a custom post type called Blurbs (translated, sort of). I want to add a static set of categories for the posts within Blurbs (i don't want the user to be able to create custom ...
0
votes
1answer
32 views

Two theme locations for two menus, but only one is showing up

Here is what I try to achieve. I have two menus. One is going to be a top navigation that lists all the pages, and the other one is going to list post categories. in my header.php, I included the ...
1
vote
1answer
59 views

Only append custom classes to nav menu items

I was reviewing this extremely helpful post on cleaning up WP-generated classes and ids from the nav menu, and found RevelationTravis's option-- see code below-- to be particularly good as a way to ...
0
votes
0answers
29 views

How do I put my Blog posts on two or three different pages?

So my site has a static front page and a blog page on my website, but I would like to show my blog on both the blog page and the static front page. Also, I have several pages representing several ...
0
votes
1answer
19 views

wp_nav_menu custom Page class

I am building a multilingual site with Polylang, and need to add custom class to my menus that groups together Pages about the same content. For example, I have a Page "Happy" and it has a translated ...
0
votes
1answer
210 views

“Static” Child Menu with Accordian

I'm looking to create a child menu and none of the examples in the Wordpress codex seem to do what I'm trying to create. I have a main horizontal nav bar, which is fine. When clicking on a top-level ...
-1
votes
1answer
24 views

How to prevent uppercasing of menu titles

My category names are being converted to uppercase when I use them as menu items. Here's how I created a category: And here's how it is displayed: Is the theme doing this or is it WordPress ...
0
votes
0answers
77 views

wp_nav_array() With A Hamburger Menu

I don't understand how the wp_nav_array works even after reading the codex thoroughly and I'm having issues with adding a menu. My html + css looks like this: <!-- Header --> <header id="...
0
votes
0answers
33 views

Add new nav menu item programmatically

I want to add new nav menu item and in the same time create new page, so my questions are: Is it enough to use wp_update_nav_menu_item() to create new page and new item in existing nav menu? And if ...
0
votes
0answers
21 views

Display parent menu item of the walker nav menu item

I have pointed the numeric index in here. each index in described below: 1. It is where the name of the currently active menu displays, 2. It is where the submenu of the parent page ...
0
votes
1answer
24 views

Nav menu from plugin to theme

I would to take nav menu reference (I have id and class) from plugin to theme header.php...How can I do this? I used something like this<?php wp_nav_menu('id'); ?> but of course with failure ...
0
votes
1answer
51 views

How to sort a sub-menu, generated with get_pages(), by the page order instead of alphabetically?

I want the top nav on a wordpress site to automatically show the child pages. I know that I can edit my menu and add the children, but I want them to appear automatically, and for the menu to update ...
0
votes
0answers
74 views

Apply Twenty Fifteen Menu Functionality to a Secondary Menu

I'd like to apply the same dynamic, category-to-subcategory dropdown menu that's used in WordPress's Twenty Fifteen theme to a new secondary menu that I've registered in a different WordPress theme (...
1
vote
1answer
2k views

wp_list_pages not showing cpt as I expected

I have a CPT called 'vacancies' here is the code that registers it: function register_cpt_vacancy() { $args = array('labels' => $labels, 'hierarchical' => false, 'supports' => array('...
1
vote
1answer
149 views

Add dynamic Sitemap to footer

I'm trying to create a footer menu/sitemap of sorts in Wordpress. (It's also worth a mention this is my fist attempt at anything Wordpress/PHP related. Context: We're making use of a template called ...
0
votes
0answers
34 views

Is there a way to retrieve post meta data from wp_get_nav_menu_object?

I am trying to integrate flexslider into my theme. I want all my post to default to flexslider post and I want to be able to customize the order of these post/slides using custom menus on the ...
0
votes
0answers
17 views

Has there been any improvements to wp's menu handling?

So I've been snooping around to see if there has been any change to how menus work in WP, but I haven't found anything yet. Some of the problems I have expereinced: Menu items still remains ...
0
votes
0answers
73 views

Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error

This is a bug in my WP install that has crept up unknowingly; I can't say for sure when it began. To describe it: there were menus created in the Appearance -> Menus page early in the site's history, ...
0
votes
1answer
33 views

Insert menu into theme location depending on user logged in/out status

I am using the Avada Theme from Themeforest and I have set up 2 menus under Appearances > Menu: menu-logged-in which contains a parent item (My Account) and then several child items; and menu-...
5
votes
1answer
2k views

How to avoid wp_nav_menu() ID conflict?

How do I avoid ID conflicts if I use the same menu TWICE on one page. FIRST wp_nav_menu( array( 'sort_column' => 'menu_order', 'theme_location'=>'menu', 'menu_class'=>'menu', 'menu_id'=>...
0
votes
0answers
11 views

A new post is showing under two menu's, how do I get it to only show under one?

I have recently added two new films to my site 'Hellesylt' and 'Artists on Film' and they appear twice, once under 'Film' and again under 'Photography', the new films do not appear on the drop down ...
-1
votes
3answers
44 views

I want my homepage navbar to have different styling to the rest of my site, how can I do this?

I am using the genesis framework, all I literally want to do is remove the navbar background colour for the homepage only. All my attempted changes have affected all the navigation menus.
0
votes
1answer
50 views

How to add custom nav_menu_css_class to certain menu only?

I want to add a custom CSS class to menu items. So far, I got it working by using the filter hook nav_menu_css_class. However, I want to add this class to items of a specific menu only. So, how must ...
0
votes
0answers
18 views

How do I redefine wm_navigation() or wp_logo() within a theme that uses hooks?

What I want to do: Move the title of my website from it's current location to be in the "menu" div so that it is to the left of the menu/page list. Demo page: http://aaronmoore.me/visartsassignments/ ...
0
votes
0answers
13 views

Get object_id with level from custom menu?

I need to get an array from a custom WP menu, which includes page object_id and it's depth/level in menu. I need this to build a table of contents in mPdf. Any thoughs?
2
votes
3answers
3k views

How to set limit only on top levels of wp_nav_menu?

How can I set a limit to the top level menu items in wp_nav_menu? Example: I have this menu in my admin dashboard: I would like to count ONLY the top level items and display a limited number of ...
1
vote
0answers
26 views

Show all data in database table and make it into an interactive table

I have to make a table where my data from my database can be stored and rearranged with every row. The name of every row should be a link to the function mymanual_edit(). Look at the image for ...
0
votes
1answer
33 views

Where to implement custom walker class?

I have created a custom walker class for changing the output of menu items. Where do I place my custom walker class file at? I have tried to ask on the Wordpress forum but it has gone 3 days with no ...
0
votes
2answers
59 views

Current menu item class issue

I'm trying to stylise my navigation menu regarding selected page. I made a page for news, but when I click on the following pages (page 2 for example), the navigation menu loses its class. I want it ...
6
votes
1answer
9k views

Menu Items Disappearing

I'm running WP 3.5.1 and I've a menu with about 100 items. When I add new items to the menu older ones disappear. I'm not running Suhosin or similar stuff. What can be the cause? Note: I'm on a ...