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
1answer
19 views

New walker for walker_nav_menu to change inside container data

I'm not really good with coding, but I have googled a lot and edit some script and it worked, but I can't achieve what I need. This is the code: class description_walker extends Walker_Nav_Menu { ...
2
votes
1answer
28 views

Comment Walker vs. Comment Callback

I've been messing around with custom comments this week and I'm trying to figure out when I'd want to use a walker and when I'd use a callback... There's some things I can't quite figure out how to ...
4
votes
1answer
48 views

Add class to top level menu item if it has multiple child levels

I have a WP nav menu, and I need to add a class to any top-level <li> if that item has more than one level of child items (meaning, its child submenu has a submenu too). Like this: <ul> ...
1
vote
0answers
9 views

Main Menu and Sub Menu Items for Footer

So I'm currently trying to figure out how to display both my main menu items and my submenu items separately in my footer. I want to display them both in separate columns (bootstrap) and am having ...
1
vote
0answers
22 views

custom walker class

I'm trying to make a navigation that has a similar structure of this website: https://grannys.ca/ But I got struck in the logic of how can I implement an if statements which determine several things: ...
1
vote
0answers
25 views

Custom navigation structure with walker class

I'm trying to make the navigation with different structures using walker class but I got stuck. Here's the code of what should the html output <nav class="main-nav"> <div ...
1
vote
1answer
49 views

add span class and i tag inside wp_nav_menu link anchor tag

I found examples adding a class to top level items, so we can display an arrow in menu items with sub-items, but is seems terrible to cope with the already built in WordPress classes, can't display ...
1
vote
0answers
26 views

Create menu / submenu from category subcategory and posts

I have a custom menu made up of pages and categories and I am trying to output the category and subcategories as well as the last 4 posts from each category/ subcategory. In trying to use a walker ...
1
vote
0answers
13 views

Navigation doesn't render when wp is hosted

I have created a theme on my local host and it works fine. I am using the walker function in order to get the bootstrap navigation. However when I upload the site on godaddy the navigation doesn't ...
1
vote
0answers
21 views

CSS_Menu_Walker not showing on mobile view?

I found this example on perishable press. My menu works fine and all the submenu items display properly. For some reason, when scaled below 769px, it disappears. I figure it's CSS, but I can't make ...
0
votes
1answer
22 views

Show post titles within Wordpress bootstrap Dropdown menu

I created custom bootstrap navwalker class for my wordpress theme all things work correctly i has this code below within function start_el(){} When i put <h2>Hellow World!</h2> within ...
0
votes
2answers
66 views

wp_nav_menu add class to child item with sub child

I need your help, am trying to add class dropdown-submenu to a <li> element which has children. Not sure if I was clear enough, so here is an example: |-Home (Parent Item) |-Services ...
0
votes
1answer
27 views

Get number of root elements in walker class

I extended Walker_Nav_Menu class as below class YPE_custom_navwalker extends Walker_Nav_Menu{} I want use the get_number_of_root_elements( $elements ) function that place in to Walker class within ...
0
votes
0answers
67 views

Extending Nav walker with Yamm menu

Here is my navigation code where only service tab should have col wise layout of menu. I am using bootstrap nav walker menu which is working fine for other nav except services menu which should have ...
0
votes
2answers
15 views

Set custom id to list element walker custom function

I am creating a navigation with bootstrap in a custom WP theme. I have managed to get this result: <li id="menu-item-27" class="menu-item menu-item-type-post_type menu-item-object-page ...
1
vote
0answers
60 views

Custom Navigation build using wp_nav_menu and walker

What I have Right now I have an old template in plain HTML. In there I use a custom Navigation menu built like this: <div class="collapse navbar-collapse main-menu main-menu-1" id="main-menu"> ...
0
votes
0answers
29 views

How to divide wordpress menu with sub-items on two ul's (using Walker Class)?

There is a great answer http://wordpress.stackexchange.com/a/36407 for splitting menu on two, and there are other great examples on web explaining how to do this, but no answer explains how to do this ...
0
votes
0answers
23 views

Accordion Menu not being called

I'm trying to add a vertical accordion menu to my custom theme, and I have no idea what is not working. The original tutorial is here : http://cssmenumaker.com/blog/wordpress-accordion-menu-tutorial ...
0
votes
1answer
34 views

How can I make wp_nav_menu() support <br> tags?

Static webpage created nav menu separating titles using <br> tags, but when I'm converting the site into WordPress I'm missing <br> tags there. How can I enable using <br> tags in ...
0
votes
0answers
23 views

How to create a custom walker class to replace the href with hashtag slug?

I was wondering how I can achieve the possibility to replace the default WordPress menu links with #slugname. How should a simple walker class should look like to achieve this? I came up with this: ...
0
votes
1answer
66 views

Counting top level items in a custom menu walker

I am creating a split menu (half the items on the left, logo in the middle, remaining items on the right). I don't really understand Walkers all that well, but I found this code snippet. This was ...
1
vote
0answers
30 views

Extend Walker Class for 2 checkbox taxonomy selection?

I am working on an add-content front end form (posts in this case). I am able to display, and add, categories and taxonomies to posts correctly with the following: <div class="checkbox"> ...
0
votes
0answers
14 views

Add parent link to its submenu

How to add parent link to its sub menu in navigation bar? I mean any hook, filter or custom navigation Walking? You may know, this problem is coined from the feature of mobile menu, I cannot go to ...
0
votes
2answers
51 views

How to Add support for sub-menu item description in wordpress?

I am working on a Custom Nav Walker and I want to use Description field in wordpress menu in my theme. The field works fine as far as for First Level Menu items but when I add something in sub-menu ...
0
votes
0answers
55 views

Dropdown menu with Foundation 5

I've had a heck of a time getting Foundation dropdown menus to work. I've got the menu itself together but can't figure out to integrate Foundation's needs for formulating dropdowns to the Walker. ...
0
votes
1answer
16 views

Is it possible to separate all submenu items?

I'm using FoundationPress as a starter theme and I'm trying to separate the submenu. My theme basically generates menus like this: <ul> <li class=" first-level has-dropdown"> ...
0
votes
0answers
22 views

Get parent item using Walker function

When using the Walker function I found out that the $item parameter contains the properties current_item_ancestor and current_item_parent but both are empty in all cases no matter if its a menu or a ...
2
votes
1answer
136 views

Custom Walker anchor tag not inheriting attributes

So I am just now learning and playing with custom walkers and I came across this really helpful Stack Overflow question. So I implemented the answer in that answer and added this to my functions.php ...
0
votes
1answer
152 views

Custom nav walker with different output depending on depth

I am trying to redevelop a HTML site as a Wordpress theme, and the HTML menu is as follows: <ul> <li class="current"><a href="#"><div>Home</div></a></li> ...
1
vote
0answers
35 views

Change submenu markup

I've seen people recommending to edit the wordpress default Walker to change the menu markup and create your own. The problem with this is that I would like to change the markup of the submenu and ...
0
votes
0answers
20 views

Walker Menu with Parent, Children, Children

This website has the menu I have been working on I used the suggestions from a question that was posted about a walker menu and it really helped and the site no longer crashers and the menu ...
-2
votes
1answer
30 views

how can i get the page_ID in nav li [closed]

I need a menu with the page IDs of the linked Pages in the li Tags. It should look like that: <ul id="menu"> <li class="pageid_23"><a href="page1">Page 1</a></li> ...
0
votes
0answers
22 views

How to separate a nav with child levels into full length menus?

I am using the wordpress underscores theme taken from https://github.com/automattic/_s I have tried to use a custom walker but am getting confused with it. All I want to do is create a list of links ...
0
votes
1answer
78 views

Extend Menu Walker Output

I've found a custom Menu Walker on the Internet that was perfect for my multilevel menu. It fitted almost like a glove. I've made some tiny improvements but now I need to limit the number of ...
0
votes
1answer
67 views

Using wp_list_categories or other function inside a menu walker?

I'm new to messing around with menu walkers in WP, so I might be trying to do something that's not possible, I'm not sure. What I'm trying to do is insert a div containing a list of my product ...
0
votes
1answer
123 views

Walker_Nav_Menu Add Strings and Class Name

How to make this pattern using Walker_Nav_Menu? <ul class="nav navbar-nav"> <li><a href="portfolio.html">Portfolio</a></li> <li class="dropdown"> ...
0
votes
1answer
35 views

Creating custom Menu for custom theme

I want to create a custom menu for my theme. The default menu architecture created by wordpress wp_nav_menu() function is made by <ul> <li> tags. But my custom Menu architecture is: ...
0
votes
1answer
103 views

has_children in custom nav_walker

I am trying to create custom menu nav walker. I added below code function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) { $id_field = ...
0
votes
0answers
93 views

How to add number of post to category menu items

I wanted to know how we can add number of posts for dropdown menu items that are categories. For example: Topics Category 1 (5) Category 2 (8) Category 3 (2) More Topics Category 1 (5) ...
1
vote
1answer
131 views

Indirect modification of overloaded property WP_Post::$classes has no effect

I'm working on a child theme and while everything works the Walker_Nav_Menu and Walker classes are causing all the fuss. My parent theme overrides Walker_Nav_Menu as below: if ( ! class_exists( ...
0
votes
0answers
62 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
58 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
56 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
59 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
81 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
196 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
167 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
131 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
118 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
147 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" ...