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

0
votes
0answers
13 views

Need help to build a menu with WP_NAV_MENU function

I have a markup where using table tag for menu creation. This is quite simple but noticed when multiple submenu exist then structure is changed. In this case i don't get any appropriate way to build ...
0
votes
1answer
16 views

Check in walker if current page is descendant

I hope this isn't a dup -- I wasn't able to find it! My goal is to, in my custom walker, append the current-menu-ancestor class to a menu item if it's an ancestor (no matter how deep) of the ...
1
vote
0answers
23 views

getting the current sub item out of total sub items in a given dropdown (custom walker)

i would like the possibility to append a text(denoted in square brackets) to each sub-item in the menu like so: Parent 1: sub-item [sub item 1 of 5] sub-item [sub item 2 of 5] sub-item [sub item 3 ...
1
vote
1answer
14 views

Programmatically (PHP) get the nr. of items in the primary navigation menu

I need to get the nr. of items in the primary navigation menu. I need this to determine the width in percentage of each list item. So I also need to change/add to the css width attribute of the list ...
0
votes
0answers
24 views

upload custom field in nav menu

I want to add image uploader for each menu element in appearance menu i have created a new walker class Walker_Nav_Menu_Edit_Custom extends Walker_Nav_Menu {} can't paste the walker here beacuse ...
0
votes
2answers
38 views

Menu location by menu id or menu ID in start_el() Walker

I'm creating a custom walker menu where I'm adding custom fields to the menu items, but I would like the fields to be specific to menu locations. I can get all the menu locations with the menu ID's ...
0
votes
0answers
60 views

Help needed for custom walker menu

need a help. I developing a WordPress woocommerce template with yamm 3 megamenu . but i am having some problem with my complex navigation structure. can anyone help me how to convert following code ...
1
vote
1answer
29 views

How to Overwrite/Customize wp-admin/nav-menus.php in Wordpress

I was wondering if is there a way to customize wp-admin/nav-menus.php so that I could add my own extra fields or tab. For example, I want to have a new tab (Menu Settings) created for each menu ...
0
votes
1answer
35 views

how to conditionally add attributes to start_lvl() function?

I want to add the id of the parent element in a container div of children elements. How can I do that? Here is my code: <?php public function start_lvl( &$output, $depth = 0, $args = ...
1
vote
0answers
46 views

using walker menu to add classes and attributes to elements

I want to use wordpress walker menu to achieve exactly this menu structure: <a href="#myid" class="list-group-item" data-toggle="collapse">Item 1</a> <div class="collapse" ...
0
votes
1answer
12 views

Count Level 1 Childs for Custom Nav Walker Wordpress

I have three levels of my menu created in custom walker class. Output is like below: home (parent) about (parent) item 1 (level 1 child) item 1-1 (level 2 child) item 1-2 (level 2 child) ...
0
votes
1answer
30 views

$args->has_children not working with start_el()

Why $has_children doesn't work here? class walker_name extends Walker_Nav_Menu{ function start_el(&$output, $item, $depth, $args) { $indent = ( $depth ) ? str_repeat( "\t", $depth ...
0
votes
1answer
37 views

How can I edit submenu headings using wp_nav_menu walker?

The whole world of menu walkers is still murky waters for me, so I'm hoping someone might be able to help me here. I'm able to produce an auto-generated list of menu items on my page using the ...
0
votes
0answers
44 views

Convert Div based navigation using wordpress nav-menu-walker?

My Structure in HTML is: <nav class="nav"> <div class="close-menu"> <img src="<?php echo get_template_directory_uri().'/img/close.png';?>" alt="close ...
1
vote
0answers
17 views

Comments not nesed with custom template

I have a custom template for to show my comments. For some reason, there are not nested while looking in the back-end of Wordpress, I see that some comments have a parent. They are simply displayed ...
0
votes
0answers
43 views

Custom Walker Class menu with different ul class and role as the dropdown

I'm trying to replicate this output menu using the Walker Class <ul class="list-inline menu" role="menubar"> <li><a href="#project" class="item">WET project</a> <ul ...
1
vote
0answers
53 views

Custom megameu walker need improvement

I'am working on a custom megamenu that will look like <li class="l-nav-item l-mega dropdown"><button class="open-icon visible-xs fa fa-angle-down"></button><a href=" ...
1
vote
3answers
52 views

Benefits of using Nav Walker?

Are there any benefits to using a nav walker class over iterating through wp_get_nav_menu_items()? Nav walkers seem very clunky to me and iterating over an array feels easier and more re-usable but ...
0
votes
1answer
68 views

Specific Page that convert Hyperlink to anchor in nav menu

I extended my Walker_Nav_Menu that converting hyperlink to anchor as I'm making one page website. Here is the code: class description_walker extends Walker_Nav_Menu{ function start_el(&$output, ...
0
votes
1answer
85 views

Walker Class: Output Parent Description and Featured Image right after sub-menu?

I've looked around everywhere but I can't seem to find an answer to this specific case. I am attempting to output the parent description and featured image of the page right after the sub-menu ...
3
votes
1answer
148 views

Custom Nav Walker menu - Display category count

I have a custom walker menu.( See the code below) I would like to have my nav menu like this: Where 495 is the total of the records containing childrens. Where 42 Number of published articles. ...
0
votes
0answers
45 views

Walker_Nav_Menu check if menu has parent

I created a custom function extending Walker Menu and having some few issues. I got a post from https://wordpress.org/support/topic/how-do-i-know-if-a-menu-item-has-children-or-is-a-leaf showing me ...
0
votes
1answer
246 views

Remove current class from sub menu items

I am building a wordpress website with drop down menu (sub menu). To achieve this here I am using wordpress walker class. This is the code which I am using in my functions.php class ...
0
votes
0answers
58 views

WordPress Page Walker class descendants of parent with thumbnail and custom classes

Please, help! I'm at my wits end and have to finish this by tomorrow, so I would REALLY appreciate any help with adjusting this page walker class. (Please!) The ultimate goal is to display a list in ...
2
votes
1answer
86 views

Create self-populating menu and add extra divs to the menu layout

What I'm trying to achieve: A menu with one level of sub-menus: PAGE 1<br> --- Page 1 sub-page 1<br> --- Page 1 sub-page 2<br> PAGE 2<br> --- Page 2 sub-page 1<br> --- ...
0
votes
0answers
136 views

Class .current-menu-item in custom menu Walker

I'm building a blog using a custom walker for my submenu which looks like this: class Submenu_Walker extends Walker_Nav_Menu { function start_el ( &$output, $item, $depth = 0, $args = ...
10
votes
4answers
603 views

Split up wp_nav_menu with custom walker

I am trying to create a Menu that shows a maximum of 5 items. If there are more items it should wrap them into another <ul> Element to create a dropdown. 5 Items or less: 6 Items or more ...
1
vote
0answers
30 views

How do you add a <div> around the second level of a Menu?

I've been searching around online and reading up on walkers but I can't figure out how to do this. Basically I need a <div class="sub-container"> wrapped around the second level of the menu but ...
0
votes
1answer
117 views

wp_nav_walker that interacts with widgets to setup mega menu

I'm a newbie WordPress developer working on a WordPress theme project that demands mega menus as part of the main navigation. I'm done with the front-end stuff, and now I'm trying to explore the ...
0
votes
0answers
128 views

How to use a start_el variable in start_lvl

On top of the sub-menu list items i would like to insert a <h2>parent-description</h2> line which i expect to show the description (or the title if wanted) of the parent item. Such as; ...
0
votes
1answer
154 views

Modifying the walker to insert parent's description above sub menus

I would like to show the title or the description of the parent item on top of the the sub-menu list items. I have basic knowledge on how to modify the walker by calling start_lvl function to insert ...
1
vote
0answers
68 views

Troubles with Walker_Nav_Menu and closing <ul>

I have an existing site that I am moving into Wordpress. My requirements state that I do not have the ability to change the HTML or CSS. I have a sidebar menu that I am trying to recreate using a ...
0
votes
0answers
18 views

How do can I pass data retrieved from a filter to template files?

I wrote this class to display only the current top level menu item's children: class deseng_navSplit { var $sorted_menu_items; var $args; function __construct($x, $y) { ...
0
votes
0answers
239 views

Add top-level menu post ID to sub-menu

I want to make collapse menu by using walker. I don't understand how to get menu ID from top-level menu. Could somebody can help? Example: menu-item-1 (li) sub-menu-1 (ul) sub-menu-item-2 (li) ...
0
votes
0answers
54 views

Can't add optional class to menu item when using Walker_Nav_Menu

As a wordpress beginner. I'm creating menu also want to customized the <li> tag to be able to assign different class name to control specific behavior through CSS so I use custom walker to get a ...
1
vote
1answer
103 views

Trying to store submenu items to render out after main menu

I'm using a custom nav walker to render out the main menu, during this I want to store the second level navigation items to use/ render out later in a separate area of the page. I want these second ...
0
votes
1answer
99 views

Add custom class to existing menu items from custom meta

I would like to add a custom class to my existing menu items. The problem is, that I would like to do something like this: <li class="<?php echo get_post_meta($post->ID, "_icon", true); ...
0
votes
1answer
75 views

Admin Panel - Disable Moving Selected Terms To Top of Metabox

By default whenever you select a category it moved it to the top of the term list, which in most cases it pretty user friendly. I want to disable this featured and leave my term list in the default ...
0
votes
0answers
7 views

How to make child class use the same signature? [duplicate]

functions.php class themeslug_walker_nav_menu extends Walker_Nav_Menu { function start_lvl(&$output, $depth, $args) { $indent = str_repeat("\t", $depth); if('primary' == ...
2
votes
0answers
170 views

How to add ID and class in nav menu walker?

I would like to set up a custom walker that produces the following output: <div id="navbarHolder"> <div id="navbar"> <ul> <li><a id="nav_about" ...
3
votes
1answer
97 views

Walker class: Problems with understanding how walk() method can be called without error

I am struggling with understanding how WordPress uses the Walker class. In particular, I don't understand the walk() method (I think). First, let me explain what I understood: When calling ...
0
votes
1answer
70 views

Custom nav walker: How to acces the $args parameter?

I am creating a custom nav walker. I noticed that the nav walker class from the WordPress core is written rather rough – much of the stuff going on could be spread out through various methods, so I ...
1
vote
0answers
178 views

Page content loading issue using Walker_Nav_Menu

At each page refresh, the page loads in steps, first the header with main menu and then after 1 second, the page loads the rest of content. I use the following code to display the a mega menu on my ...
1
vote
1answer
51 views

Wordpress empty Nav Menu error

i have created Multisite. i have assigned menu for the first sub domain while for the second sub domain i have not assigned Menu. i just enabled the Debug mode and got Following error: Notice: ...
0
votes
1answer
182 views

Add Thumbnail to wp_list_categories()

I'm using the following code to display a list of my taxonomy terms in my home page: $customPostTaxonomies = get_object_taxonomies( 'guide' ); if( count( $customPostTaxonomies ) > 0 ) { ...
0
votes
1answer
172 views

How does the Walker class works?

Can someone explain me how the walker class works and does the methods inside the class always needs to overload the parent method?
0
votes
1answer
174 views

wp_nav_menu - page template name as item class

Is there any way to display template name (or page-template.php filename) in each menu items' class? Maybe using wp_nav_menu walker? Specifically, I'm using standard menu call: wp_nav_menu( array( ...
2
votes
1answer
48 views

Add custom html to nav_menu

Im trying to add some html to the nav_menu. Basically I need a button tag inserted after the opening li tag if there are children in the menu. I see that there is a walker class but I have no idea on ...
0
votes
0answers
83 views

Can't get nav_walker class to recognize pages with children

I've built a walker class and I've got it doing everything I need except inserting a single div tag. In the start_el there is an $args>has-children that works and adds a div tag before top level ...
0
votes
0answers
81 views

Dynamic multi column menu

I have a dynamic menu where the submenu is based on specific content from the page. With help from Uruk on the this thread We(he) made it work. What I realise now is that if a page contains a lot of ...