Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [walker]

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.

0
votes
0answers
14 views

Add number in increment of one to menu items

I'm trying to add sequential numbers to menu items in increments of one. So right now where I have the following: <li class="menu-item menu-item-type-taxonomy menu-item-object-category"></...
0
votes
1answer
16 views

Difference between “Walker_Nav_menu” and “walker”

Does anyone know what is the difference between extending Walker_Nav_menu and walker. I learned about Wordpress Nav Walker and found several different tutorials. Do they extends different classes ?
0
votes
0answers
15 views

wp_nav_menu() filter - preg_replace value returned wrong

I'm having an issue where the filter I've added to wp_nav_menu() is adding code to the second level of the navigation. How can I change the filter or the preg_replace code in a way that only adds it ...
0
votes
0answers
19 views

Where to place a svg chevron down in my custom walker?

i am a bit stuck with the custom walker in my Wordpress theme. I wanted to place a svg chevron down on the first link when a submenu is detected. My theme uses a svg file with all the svg paths. The ...
0
votes
0answers
27 views

CSS Classes (optional) is not working on the ul li a?

I'm working on the working custom theme development where i need to add custom and additional class to the ul li a i have added extra class using CSS Classes (optional) but problem is that extra ...
0
votes
1answer
35 views

Add parent menu item in sub-menu in custom nav_walker

Currently I'm working on a project where we need to append the parent title as first item in the submenu for a mobile menu. What I try to achieve is this: <ul class="menu"> <li> ...
0
votes
0answers
13 views

Add custom nav walker to UberMenu instead of wp_nav_menu

I am working on a website, that has a custom walker added to an existing nav menu. The code works great for a standard wp menu, but I cannot seem to add the same walker to an ubermenu (www.wpmegamenu....
0
votes
1answer
32 views

Custom Category Walker with Image, Fallback to Most Recent Post in Category Image

Based on this and this answer I am developing an extension of the Walker_Category which displays in image from an ACF field, falling back to the latest post's thumbnail. I have included the entire ...
0
votes
0answers
38 views

wp-bootstrap-nav walker collapse is not working on ipad

Bootstrap navbar collapse is not working. The issue is that it shows a collapsing menu but on click, it is not collapsed. I have provided my full code so that it can help you to suggest or help me to ...
1
vote
1answer
22 views

Dynamic_sidebar inside wp_nav_menu

I have Menu created by wp_nav_menu. Inside it, I want to set dynamic_sidebar but wp_nav_menu instead of displaying the content, throws 1. Have everyone some tips for display sidebar inside ...
0
votes
0answers
37 views

Can't seem to override start_lvl & end_lvl in Walker_Nav_Menu class

Can Anyone tell me why I can't seem to override this class. Here's my wp_nav_menu function build_topbar_nav() { wp_nav_menu(array( 'container' => false, 'theme_location' =>...
0
votes
1answer
38 views

Wordpress customizing a walker menu class

Hey Folks I trying to customize a wordpress walker class to add custom classes to navigation level. Essentially there will be 3 levels of navigation. Here's the code: <ul class="rd-navbar-nav">...
0
votes
0answers
44 views

Walker Nav Menu Depth

I've been looking for a way to add spans to my mobile menu so they can be targeted with jQuery. I found a custom walker_nav_menu and it works well and adds a span to menu items which have children. ...
1
vote
1answer
27 views

Put class on <a> instead li

I integrate a template into Wordpress theme. But I have a trouble with the menu. The menu come with class in <li> like <li class="nav-link"> if active <li class="nav-link active"> ...
0
votes
1answer
1k views

Add active class to wp_nav_menu

I'm using this code but it's not working function special_nav_class($classes, $item){ if( in_array('current-menu-item', $classes) ){ $classes[] = 'active'; } return $classes; } ...
0
votes
1answer
149 views

Remove a class from a <li> using Walker

I want to remove a class from 2 lvl depth,from li tags of ul class="sub-ul".How can I do that using Walker? <ul class="navigation d-block"> <li class="d-...
0
votes
0answers
248 views

Bootstrap 4 navwalker - multilevel menu

I'm using this nav walker in my Wordpress project. I want to create multilevel menu, for example. What I need to change to get it work? Or maybe is it another walker for BS4 with multilevel menu ...
2
votes
0answers
20 views

Use walker for specific menu, or avoid use of walker

I'm trying to solve a particular problem and having trouble figuring out which way is best. So, I have a menu (generated through WP's menu creator) and would like to pull the featured image of each ...
0
votes
0answers
207 views

Custom second level for understrap_WP_Bootstrap_Navwalker

I have a custom menu structure that looks like this: <ul class="nav"> <li class="nav-item"> <a class="nav-link" href="#">Standard link</a> </li> <...
0
votes
1answer
136 views

Walker menu not displaying at all

I am having trouble trying to get a menu with dropdowns to work. This is the non-wordpress menu: <ul class="nav navbar-nav" data-in="fadeInDown" data-out="fadeOutUp"> <li class="dropdown"...
0
votes
0answers
27 views

Secondary Menu based on current page

I have two levels of menu items. The first is Cars, like "toyota" and "Lexus." the second level has pages that relate to each. So its Fuel, Price, and Safety. Each of the child pages will be unique ...
0
votes
0answers
19 views

Bootstrap Navwalker Logout Link

I'm using bootstrap navwalker for menu generation. I need to add an Logout link that would log the user out without the confirmation logout page. if ( is_user_logged_in() ) { $output .= '<li&...
0
votes
1answer
53 views

Custom Walker menu depth opening problem

I'v create custom categories walker menu: <?php /** * Show Categories menu * */ $seller_id = (int) get_query_var('author'); ?> <aside class="cat-menu"> ...
0
votes
1answer
65 views

Output existing wp_nav_menu with a custom walker

I am trying to output another wp_nav_menu if an existing wp_nav_menu item has a specific class like this.. /* Custom Walker */ class IBenic_Walker extends Walker_Nav_Menu { // Displays start of an ...
3
votes
1answer
180 views

Using string instead of object class instantiation on the walker argument breaks wp_nav_menu

I'm trying to replace the walker argument from new My_Walker_Nav_Menu() to a string 'My_Walker_Nav_Menu' in this wp_nav_menu call (which works as is) wp_nav_menu( array( '...
0
votes
0answers
99 views

Tabindex attribute being filtered out of custom nav walker?

I have a custom nav walker that performs a number of functions. Because my navigation menus are hidden at the outset, and ought not be keyboard accessible until the menu button is clicked, I am trying ...
0
votes
1answer
64 views

How to remove a sub-menu using walker hooks/filters without relying on a custom walker?

I currently built a pretty simple tool to create a mega menu. I add a checkbox to my menu items in the Appearance > Menus section followed by a dropdown that includes template files within the theme. ...
0
votes
0answers
47 views

Walker only for sub menu

I try, with a walker, to add the thumbnail as image-background of sub-menu. This is my walker : class MyTheme_Walker_Nav_Menu extends Walker_Nav_Menu { function start_el( &$output, $item, $depth ...
0
votes
1answer
295 views

Add custom class to li element which has children

How I can output specific class or something else (for Example data-toggle="treeview" )for li element which has children? I use custom walker <?php # -*- coding: utf-8 -*- /** * Create a nav ...
1
vote
2answers
63 views

Editing Wordpress Nav Menu Walker

I have conntected T5_Nav_Menu_Walker to my WP website. https://gist.github.com/thefuxia/1053467 And I want customize my WP menu to be able to add icons from wp-admin via FontAwesome classes. ...
0
votes
2answers
21 views

How to append something before final </ul> tag in walker class?

Here is the real picture I want to produce. <ul> <li> <ul> <li> </li> <li> </li> ###NOT HERE ### ...
0
votes
1answer
57 views

How to actually make menu walker alive on admin interface?

I seen many articles about navigation menu walking: http://hookr.io/4.5.2/files/wp-admin-includes-class-walker-nav-menu-edit/ How to add a custom field in the advanced menu properties? the problem ...
1
vote
0answers
43 views

walker - 0 level on submenu formatting

I need to create this structure: <div class="submenu-box"> <ul class="submenu-box__links">...</ul> <ul class="submenu-box__links">...</ul> <ul class="...
3
votes
1answer
101 views

What does the “$depth” parameter in the Walker_Comment stand for?

I'm trying to write a custom comment class for my comments and I've been trying to de-construct the code for quite a while, here it is: class Custom_Comment_Walker extends Walker_Comment { var $...
2
votes
1answer
958 views

How to add parent element's title to nav menu's child?

Here is a simple output of the default navigation menu mark-up: <ul> <li><a>First Item</a> <ul class="sub-menu"> <li><a>Some Child ...
0
votes
0answers
696 views

Get parent link or id on nav walker

I have a custom nav walker, but I want to add a link to the parent at the top of submenu. I need something like this: function start_lvl(&$output, $depth = 0, $args = array()) { global $...
0
votes
1answer
61 views

How to display different submenus?

The following main structure is given: <div id="et-top-navigation"> <nav id="top-menu-nav"> <ul id="top-menu" class="nav"> <li id="menu-item-102" class="...
-1
votes
1answer
310 views

how to make a walker to this (in bootstrap, i try but not work)

BrandName <div id="navbarCollapse" class="collapse navbar-collapse justify-content-start"&...
0
votes
0answers
924 views

how to split vertical menu into two columns using walker nav menu

i would like to create a footer vertical menu but it should be split into two columns using walker nav menu, but i want to add <div class="col medium-3 small-12 large-3"> and h5 tag before each ...
0
votes
3answers
689 views

how do you create this customize menu using wp_nav_menu function?

how do you create this customize menu using wp_nav_menu function? function.php file register_nav_menus( array( 'header-menu' => 'Header Menu', 'footer-menu' => 'Footer Menu' ) ); ...
0
votes
2answers
65 views

Classes CSS (Optional) - how do I reference this in php?

I've read an infinite (yes there seems to be more than I care to read) same articles on how to apply a classes to the anchor not the link element using nav_menu_link_attributes and a walker. However, ...
1
vote
0answers
34 views

Get Menu Name inside walker

I am trying to add some checkboxes to the menu editor in the WP admin area. I have successfully added them by creating an extension to the Walker_Nav_Menu_Edit class. The checkbox is shown and it ...
0
votes
1answer
2k views

(Solved) How to add a submenu toggle button inside all “li” elements that have a submenu?

I'm building a mobile navigation menu. I wan't the menu to work like this: In this image you see a mobile nav with multiple depth levels. This is how I wan't the code structure to look like: <ul&...
0
votes
0answers
884 views

Custom Nav Walker sub-menu

I am trying to change the markup of my main menu. Currently I've got the following code when my menu is generated : <ul id="menu-menu" class="menu vertical medium-horizontal"> <li><...
0
votes
1answer
98 views

Extending Walker_Nav_Menu in wp_nav_menu List of Empty Items

This has been confounding. Trying to implement a WP nav walker for pureCSS. Found two seemingly easy routes via this tutorial and this gist. However I'm coming up with an empty menu! The header: ...
1
vote
1answer
2k views

Bootstrap Navwalker not displaying

I am creating a bootstrap wordpress theme from scratch, i want to create a nav menu using WordPress nav walker class, i followed the documentation on GitHub to install it, then i added a primary menu ...
0
votes
1answer
1k views

Parent link need to go first child submenu

I use this walker for menu in functions.php class main_menu_walker extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { global $wp_query; $indent = ( $...
0
votes
2answers
379 views

Determine the last child of the parent menu WP Nav Walker

Is there a way to add a condition to know if the current item of the navigation walker is the last child of the menu or parent? | Item 1 | Item 2 | | - Item 1.1 | - Item 2.1 | | - Item 1....
0
votes
1answer
292 views

How to get the term id inside the start lvl method of category walker?

I'm trying to implement the category walker with wp_list_categories to help me manipulate list classes, which i want to get the term id within the start_lvl method, so i tried to use $category->...
-1
votes
1answer
879 views

Broken drop down menu using Bootstrap and navwalker class

I am using Bootstrap + navwalker class and my problem is that the drop down menu doesn't expand when clicking. The odd thing is that if I change the URL from where the bootstrap.js is fetched to an ...