The Walker class was implemented in WordPress 2.1 to provide developers with a means to traverse tree-like data structures for the purpose of rendering HTML.

learn more… | top users | synonyms

43
votes
3answers
43k views

Menu items description? Custom Walker for wp_nav_menu()

Normal Wordpress Menu looks like: Home | Blog | About us | Contact But I've seen many pages with descriptions under these links: Home Page | Our Blogs | About us | ...
10
votes
3answers
2k views

Custom Nav walker display current menu item children, or siblings on no children

I've been messing around / searching for hours and still can't get this to work, so i'm finally giving in and asking for some help. I'm trying to write a custom walker that shows only the current ...
7
votes
2answers
912 views

Add Caret to Menu Items with Sub-Menus in WordPress Theme

I'm working on a custom theme using wp_nav_menu(). What I want to do is add a caret to menu items that have sub-menus. For example, If my menu looks like this: Menu Item 1 Menu Item 2 Menu Item ...
7
votes
1answer
228 views

What is a good resource to find out about making custom walkers?

Custom walkers seem to be a poorly-documented area of WP. Online tutorials focus on styling the output, not on directing the walker to go where you want it. I am reading the code, but I wonder if ...
6
votes
2answers
222 views

Assign posts to taxonomy terms instead of the taxonomy terms to posts?

So I have a custom post type (people) with a related custom taxonomy (directory). Instead of editing a person and then choosing the related directory organizations I'd like to "edit" a directory org ...
5
votes
2answers
2k views

WordPress Menu Custom Walker Class

We are using a jQuery UI accordian to render a menu in the sidebar. We've already written the markup and javascript and I am just trying to get the wp_nav_menu to output the same markup we've already ...
5
votes
1answer
5k views

Display only page specific sub menu items using Custom Walker

I've just implemented the technique described at http://wordpress.org/support/topic/wp_nav_menu-list-only-2nd-level-separate-submenu/page/2 when implementing a theme for a client. When I run the theme ...
5
votes
2answers
299 views

Call custom field into menu item

I have a navigation menu in Wordpress. I would like it to check if the page has a custom field of "menu_icon" and if it does, add that custom field into the menu item it corresponds to. I'm sure this ...
4
votes
3answers
1k views

start_lvl ignored in custom walker_nav_menu

This is my first project involving wordpress and i've got stuck trying to create a custom walker for a footer menu. I basically want to change the menu from the <ul> <li></li> ...
4
votes
1answer
186 views

List Hierarchical Term List with Count with Related Term

What I have are custom posts (of a custom post type, wps_business) that have two taxonomies (wps_location & wps_type), and I would like to list all the terms from type of a specific location. For ...
4
votes
4answers
119 views

Any walker causes blank menu?

Using the following, or any other custom Walker_Nav_Menu seems to cause a blank navigation menu, I tried specifying the default to make sure I wasn't going crazy yet it still blanks the output... Any ...
3
votes
2answers
105 views

How does a minimal menu walker look like?

According to the docs of wp_nav_menu we can specify our own walker function. They suggest to copy the default one and modify it as needed. But to be honest, it is a bit too complicated for the to ...
3
votes
3answers
751 views

Incrementing a class in a custom walker

I have written a custom walker that I am using with wp_nav_menu but I need to iterate through 4 custom classes, and I'm not sure how to do this. Basically, each menu-item <li> needs to be given ...
3
votes
1answer
2k views

Why is my menu order not working with wp_nav_menu?

I have a custom menu using the new Menu System but it is not returning in the correct order. I have no idea what order its in - its not alphabetical, or by date, or by any pattern I can see. The link ...
3
votes
1answer
953 views

Determine if a navigation item has children

I am trying to determine if an item has a sub-item with depth 1 or higher. I cannot find anywhere if there is some function/query I can write that grabs the current item looks in the database if it ...
3
votes
1answer
410 views

Extend walker class with custom post types [closed]

I'm using the walker class below, but I can't make it work with custom posts. class Zwp_Walker_Nav_Menu_Dynamic extends Walker_Nav_Menu { function end_el(&$output, $item, $depth) { ...
3
votes
1answer
233 views

Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?

Essentially I'm trying to add multiple sub nav menus and I'm pretty close but I just can't seem to find the right tack to solve my problem ... I'm using a variation of a Stu Nichols CSS Menu ... ...
2
votes
4answers
3k views

Adding a class (arrows) to main menu links that have children?

I'm wondering if it is possible to add different classes to second/third/fourth/etc-level items that have children in Appearance > Menus tree? That's how I call the menu: <?php $menu_args = ...
2
votes
4answers
2k views

Custom Walker: how to get ID in function start_lvl

I am making my first custom walker to build an accordion menu. To start with I used this example: http://bitacre.com/2025/custom-nav-menu-walker-for-wordpress-themes There are two functions. First ...
2
votes
1answer
925 views

Using a menu walker add a custom item at the end of the menu's items

I need to add a search field at the end of a menu in a list item. I've been looking at walkers but finding it really hard to figure out what is the last item (or even get the total). Also where would ...
2
votes
2answers
921 views

Strict Standards Error bootstrap navwalker

I am having trouble understanding this error and I've not come across it before, please could someone help? Strict Standards: Declaration of wp_bootstrap_navwalker::start_lvl() should be compatible ...
2
votes
1answer
1k views

Add a custom walkter to a menu created in a widget

I know how to add a Walker to a custom menu created by the theme (menu named primary in this example), but how can I target a menu thats created in a widget with the default wordpress custom menu ...
2
votes
1answer
1k views

Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu

I am trying to add some ARIA related stuff to the wp_nav_menu function. I use a custom walker class for this purpose: class Walker_Nav_Menu_With_Aria extends Walker_Nav_Menu { function ...
2
votes
1answer
1k views

Sub-Pages only of menu items in current branch using a custom menu

Although I did a thorough research I could not find a solution. Only solutions coming close. My custom menu ("top") shows this structure (you see a part of it): page 1 subpage 1.1 category A ...
2
votes
1answer
580 views

Show top-level parent with submenu menu walker

I've used the menu walker below to display dynamic submenus with great effect in the past. It displays 2nd- or lower-level menu items IF the current page is a parent, sibling, or descendant of the ...
2
votes
1answer
296 views

Adding 'active' class to custom taxonomies using walker in functions.php

I'm trying to use the following code in functions.php in order to show a menu with categories (custom taxonomies actually). I simply want it to show active when on the current page. What am I doing ...
2
votes
1answer
388 views

Custom Nav Walker to show siblings and children of current branch?

I have seen very similar (if not exact) queries to this all over Google, but always seem to find something short of what I need. I am trying to create my full vertical menu using wp_nav_menu in my ...
2
votes
1answer
2k views

How do I dynamically populate wp_nav_menu from a custom taxonomy?

I know this question has been asked in different forms. But as far as I can tell from searching Google and SE/WP it's never been satisfactorily answered. Let's say I have a taxonomy clubs and a ...
2
votes
1answer
434 views

Adding dynamic content to end_lvl in Walker Class

I'm trying to add unique content to the end of each dropdown (sub-menu). I've managed to edit the end_lvl function of the walker class to add the div to the end of each sub-menu, but now I'm lost on ...
2
votes
1answer
532 views

Walker gives additional taxonomy name?

I'm a beginner at Wordpress, so I would appreciate it if any of you could nudge me in the right way. Anyway, what irks me is how wp_list_categories (and similar functions) produce a lot of unnecessary ...
1
vote
3answers
1k views

How do I pass an argument to my custom walker?

I've set up a custom walker, and it works as desired when I hard code my variable. What I want is to be able to call my walker and pass it a variable that is used in the walker. For example: ...
1
vote
1answer
72 views

Walker nav remove submenu ul from a certain depth

I want to remove sub-menu ul and .menu-item-has-children class when the menu depth is superior or egal to 2. So, I only want a menu with 3 sub-menu at maximum. Other item children will still ...
1
vote
1answer
34 views

Removing <li> from Comment

I'm making a custom comment template, and I do not wish to use a list to display comments. By default, WordPress puts the following at the end of every comment: </li><!-- #comment-## --> ...
1
vote
1answer
819 views

Customizing Walker_Nav_Menu

I'm looking for a solution to adjust the output of wp_nav_menu only on a specific navigation menu. I have my menu: wp_nav_menu( array( "container" => "nav", ...
1
vote
1answer
42 views

Limit Custom Crawler to front end only

I am using the following custom walker to hide the Login and Register pages from my navmenu created with wp_get_nav_menu_items..... function wpse31748_exclude_menu_items( $items, $menu, $args ) { // ...
1
vote
3answers
3k views

How to count nav menu items?

I'm creating a custom walker for my nav menu. The goal is to split the menu in to columns like so: I can easily determine where I am in the list by looking at $item->menu_order. What I don't ...
1
vote
2answers
1k views

Bar separated navigation by extending Walker_Nav_Menu

I have the following menu in my header: <?php $args = array( 'menu' => 'Main Menu', 'container' => false, 'depth' => 1, 'items_wrap' => ...
1
vote
1answer
49 views

Use menu class in walker function

Is there anyway, using the custom menu css classes that are turned on in the option, to apply those via a walker function to the span instead of the li's? My custom walker: class ik_walker extends ...
1
vote
1answer
85 views

Custom walker nav - Add sequential number as class

I'm getting to grips with the walker at the moment, but i need some assistance in getting my desired effect. My walker function looks like: class ik_walker extends Walker_Nav_Menu{ //start of ...
1
vote
2answers
359 views

How to remove trailing </li> tags from wp_nav_menu walker

I have used theme twenty thirteen a my base theme and Have tried used code from http://stackoverflow.com/questions/12159486/wordpress-change-header-navigation-list-items-to-div when I try to validate ...
1
vote
1answer
301 views

Customize comment list markup

While creating a new theme, we'll have to customize the comment flow. For doing so there are two functions: wp_list_comments() and get_comments(). I am not very sure how to style the inner elements ...
1
vote
1answer
127 views

custom walker wp menu last element

I have a menu list with many subitems that contain submenus as well (at the moment some reach 4th level). How can I put on each last descended ul of each li element a class ".last"? for example I ...
1
vote
1answer
745 views

wp_nav_menu, walker class, categories as classes of li

OK I'm trying to show my principal menu so I use the following code: <?php $defaults = array( 'theme_location' => '', 'menu' => '', 'container' => false, ...
1
vote
1answer
616 views

Make wp_list_pages print slugs instead of titles

By default wp_list_pages spits out an unordered list of post titles. To save space in a sidebar menu I´m trying to create a list of page slugs instead of page titles. I suppose I´ll need to write a ...
1
vote
2answers
95 views

Querying both pages and posts

I am building an "advent calendar" for a client and they are wanting a combination of specific pages and custom posts appearing on the front page, in a specific order. Things that need to be ...
1
vote
0answers
13 views

Get top items number from wordpress menu

I've made a menu in Wordpress backend with 3 levels depth. (4 main tabs with 2 sub level items) I would like to know how I can get the number of tabs created automaticly and add this number to a ...
1
vote
0answers
12 views

Walker_Nav_menu access parent menu name

I extended Walker_Nav_Menu with the code below and I would like to replace [TITLE HERE] with the name of the parent menu... In my menu I only display one depth of the navigation at a time. So I would ...
1
vote
0answers
11 views

Rendering of custom walker menu function not working properly

I have a custom function for my nav walker menu that adds custom php/html to it, which can be seen below. It renders a twitter bootstrap dropdown menu that I would like to put my login form in. ...
1
vote
0answers
25 views

Can I use multiple nav_walkers?

I am working on a project and I came to the conclusion that I need to use 3 nav walkers: one for edit and 2 for HTML formatting class MY_Walker_Nav_Menu_Edit extends Walker_Nav_Menu {} // this ...
1
vote
0answers
78 views

Walker Class - Check if menu item has description and if so add class to li

I am using a pretty common walker class to pull in the description when I call the wp_nav_menu function. I am using this to add an optional second line for the menu, using the description. This of ...