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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
12 views

Conditionally get ACF field in Wordpress nav walker based on parent menu item?

I am building out a mega menu for a site and I have some ACF fields set up that I want to display in each of the sub-menus in the navigation. I want to specify which field to used based on which ...
user13286's user avatar
  • 403
0 votes
0 answers
37 views

Remove Wordpress Menu Classes and ID with Bootstrap Walker

How to remove generated WordPress menu classes and id and only keep the Bootstrap recommended ones without affecting the functionality of the Navbar. I found this code which looks good and I've ...
David Buik's user avatar
1 vote
1 answer
843 views

WordPress nav Walker - Bootstrap 5.2.3 - submenu not opening

I'm trying to integrate WordPress Nav Walker with a two level dropdown, so: URL -URL2 --URL2 --URL23 I am using this code: wp_nav_menu(array( 'theme_location' => 'main-menu', ...
Pbalazs89's user avatar
  • 115
0 votes
2 answers
90 views

wp_dropdown_categories() show elements checkbox

I have a code in my functions.php and I would like to use wp_dropdown_categories for displaying list product categories but I wont in "select" only "checkbox". I edited my code in ...
gsskrzysztof's user avatar
0 votes
1 answer
853 views

WordPress Nav Walker - Top menu link with dropdown link not clickable (dropdown opens)

I'm trying to setup a WP NAV WALKER with dropdowns. The links work fine, the dropdowns work fine, however the parents of dropdowns should also have links, but they don't trigger, instead, they just ...
Pbalazs89's user avatar
  • 115
1 vote
1 answer
67 views

Append a code when at the current page in wp_list_pages()

I'm using wp_list_pages() to show pages and subpages in a tree view and I need to add a "read more" as a sub-item right after the current page. Example: We are at the "Page tree" ...
Diana's user avatar
  • 1,238
0 votes
1 answer
212 views

Wordpress change wp_nav_menu walker with a custom one

I have a downloaded theme and it where the wp_nav_menu is created it looks something like this: <div class="nv-nav-wrap"> <div role="navigation" class="<?php ...
Roland's user avatar
  • 101
0 votes
0 answers
28 views

Hook or callback when wp_nav_menu() has completed

I am modifying the $output of wp_nav_menu() using a custom walker, and I need to run a function after the final closing </ul> of the entire menu. I can only see the following methods available: ...
Chris J Allen's user avatar
1 vote
0 answers
43 views

Walker class conditional based on parent menu item label or custom css class

I'm out of my shallow depth here. I'm trying to add html to the end of drop down menus whose parent item is either a specific item label or custom css class that's been added via the WP menu admin. ...
David M's user avatar
  • 11
0 votes
0 answers
187 views

How do I add 3rd level of dropdowns to wp_nav_menu array?

How do I get 3rd level to show? <?php wp_nav_menu( array( 'theme_location' => 'primary', 'container_class' => 'collapse navbar-collapse', '...
RLM's user avatar
  • 247
0 votes
1 answer
950 views

Adding a unique ID to each sub-menu

I have the following menu via header.php: <?php wp_nav_menu( array( 'container' => false, 'theme_location' => 'primary', 'items_wrap' => '<ul class="...
Sam's user avatar
  • 2,106
0 votes
1 answer
462 views

Add attributes to wrapper html generated by wp_nav_menu

I want to add some extra html attributes to the default div html generated by wp_nav_menu. I need to add simple code for example a short style code: style="top:10px;" I can't do what I am ...
Angel Hess's user avatar
0 votes
1 answer
927 views

How to include second layer sub menu to Walker Nav?

I need to be able to access the sub-menus of the sub-menus on my nav. Currently I'm only able to access the first sub-menu layer. What do I need to add to access these? <?php class ...
RRhodes's user avatar
  • 105
1 vote
1 answer
812 views

Create wordpress header with custom logo in between the menu splitting the menu into two equal parts [closed]

I would like to Create A Wordpress header with {the_custom_logo();} custom logo in between the menu splitting the menu into two equal parts so that the logo is always aligned to the center of the ...
Kevin Kenan's user avatar
0 votes
1 answer
167 views

Adding markup to sub menu based on class

I would like to add a div at the after a sub menu. I would like to apply this change only if the parent menu item has a class name of product-menu (comes from CSS class field under menus section in WP ...
imz's user avatar
  • 1
1 vote
0 answers
70 views

WP Menu Walker - How to know total depth from inside the start_lvl() method

The start_lvl() method allows to know the current $depth parameter. But, I need to output different results at level 1 if the menu has x or y total levels. I did a print_r() of the $args array, but ...
Álvaro Franz's user avatar
0 votes
0 answers
136 views

Help with Wordpress Custom Nav Walker

I want to convert my navigation menu in custom wordpress theme, I have created the design using html/css and now for the naviation bar I want to make it dynamic so it can be manipulated from wordpress ...
AliShafi's user avatar
0 votes
0 answers
29 views

Why is my navigation in my onepage not working?

I have a one-pager who has two sites. One is German and the other English. I made an own navigation for the English one, but it doesn't work. The navigation is throwing me back to the German one. The ...
steffi's user avatar
  • 1
0 votes
1 answer
58 views

url_to_postid method in walker_nav navigation menu causing exceptionally high TTFB

I am using the walker class to create my custom mega menu, and using it to display post thumbnails at a menu depth of 2. It seems using the url_to_postid method seems to be causing a high ttfb of >...
Prateek Pandey's user avatar
1 vote
1 answer
395 views

How to add ID attribute to each submenu?

I would like to add an ID attribute to each list <ul> submenu. I am using the Walker class extension. I have managed to modify some elements, but I am left to solve this one problem. I need the ...
nsog8sm43x's user avatar
1 vote
0 answers
74 views

Why does the argument list_only do on Walker_Category_Checklist::start_el?

On the post edit screen there is the meta box for categories that utilizes the Walker_Category_Checklist class to create the category checklist within the meta box. One of the conditions (line 90 of /...
davemackey's user avatar
0 votes
1 answer
574 views

How to modify the output of wp_terms_checklist when used within the built-in category metabox on edit posts?

On the Edit Screen in the WP Admin there is a meta box for WP's built-in Category taxonomy. This meta box is built using post_categories_meta_box() (/wp-admin/includes/meta-boxes.php). This meta box ...
davemackey's user avatar
1 vote
0 answers
141 views

Automatically adding new post categories to menu

Disclaimer: I am not 100% fluent in php. If I am doing something wrong in asking this here, please let me know. Many thanks! A site that I am working on is set up with several custom post types: City, ...
user8693051's user avatar
1 vote
2 answers
205 views

Can't extend some core classes

I am relatively new to wordpress development, I am trying to extend 'Walker_Category_Checklist' class found in /wp-admin/includes/class-walker-category-checklist.php to customize it for ...
MoSaber's user avatar
  • 11
0 votes
1 answer
532 views

wp_list_categories walker without links on categories that have subcategories (to make a nested dropdown menu)

I'd like to make a custom walker that works with wp_list_categories to generate a menu of nested uls using my category, sub-category, and sub-sub-category(?) structure. Any category that has sub-...
EdA's user avatar
  • 103
0 votes
1 answer
134 views

Is it possible to get_the_post_thumbnail (Featured Image) inside a sprintf function?

I am trying to add the featured image of posts to my mega menu. I want to display the featured image inside a div tag. How would i add the featured image inside of a sprintf function? $thumbnail = ''; ...
Prateek Pandey's user avatar
0 votes
1 answer
25 views

How can I creat custom menu with bootstrap

I'm trying to create bootstrap collapsing navbar for WordPress template. I have to add some HTML properties such as data-toggle. After researching, I found that must customize the Walker class but ...
Mohammad Mohammadi's user avatar
0 votes
1 answer
2k views

Wordpress menu walker - help to add custom class for each submenu

I am trying to apply to my already existing menu a walker in order to add custom classes to every sub menu anchor tag. Here is my menu: wp_nav_menu(array( 'theme_location' =&...
Pikk's user avatar
  • 277
0 votes
0 answers
135 views

Need help with Walker_Nav_Menu class

I am trying to learn how to use walker_nav_menu for past week but can't find the right material. WP documentation just cover simple definition of walker nav menu class. And most of the resources i ...
eddy's user avatar
  • 101
0 votes
2 answers
955 views

How to remove an item from a custom Walker_Nav_Menu

I have a custom menu on a wordpress + woocommerce site using the Walker_Nav_Menu class. When hiding posts (products) from the site those posts and category are still included in the custom menu. I ...
MarvynH's user avatar
0 votes
0 answers
27 views

Structuring Nav Menu and Background Custom page (Help)

i´m creating theme is my first theme and i have a problem with panel nav menu of wordpress, I´m creating the order of nav menu in the panel wordpress and does not order, i was make page and ...
Aisakk's user avatar
  • 1
0 votes
0 answers
416 views

Can I now add a class in the anchor of my menu item with Wordpress 5.4?

I am using the following code in my functions.php file: function add_menuclass($ulclass) { return preg_replace('/<a title="All"/', '<a title="All" class="addition-of-class-name"', $ulclass, 1); ...
Siyah's user avatar
  • 193
0 votes
0 answers
63 views

why are my walker menu is showing like this?

<?php /** * The second Header template for our theme * * Displays all of the <head> section and everything up till <div id="main"> * * @package WordPress * @subpackage ...
Fatima Shakeel's user avatar
1 vote
0 answers
70 views

How to create this Custom Walker Menu

It's the first time I'm trying to create a customized menu Walker. I'm following a very specific HTML. I searched and tried different things. Days have passed and I still can't get it right, but I don'...
Azametzin's user avatar
  • 111
2 votes
1 answer
1k views

How to dynamically add custom taxonomy terms as a sub-menu of an existing menu item, using custom walker class

Desired outcome I have a custom post type and belonging to it, a custom taxonomy. I'm trying to get my child theme dynamically add the terms belonging to that taxonomy as a sub-menu under a certain ...
Spcaeyob's user avatar
0 votes
1 answer
21 views

Displaying Nav Menu

I want to ask if this <?php wp_nav_menu( array('theme_location' => 'primary') ); ?> get all the sub-menu automatically? I saw this one of my downloaded theme and it displays all the submenu ...
Lucifer Levi's user avatar
0 votes
0 answers
122 views

Stuck while adding bootstrap navwalker class

I am stuck while adding Bootstrap Navwalker class in WordPress. All is going well, but when minimize screen to mobile view the Menu disappear. However the Search box is still showing. header.php <...
Imran Khan's user avatar
0 votes
1 answer
349 views

Is it possible to display the Navigation Menu without using Walker_Nav Class

I want to ask is it possible to display menus and submenus without using Walker Nav Class? I'm just to happen when I download a free theme using bootstrap and I do not see a start_el for navigating ...
Lucifer Levi's user avatar
0 votes
1 answer
276 views

What is inside in $item in start_el function in Walker_Nav_Menu class

I want to know what are exactly inside the $item in start_el function in Walker Class. Thanks in advance
Lucifer Levi's user avatar
0 votes
0 answers
920 views

Multi-Level Nav Bar

Is there anyone here with a sample code for using walker class with multi-level function. I have a Nav walker class but it seems that it can only traversed to first element like this: <ul> &...
Lucifer Levi's user avatar
1 vote
1 answer
401 views

Remove unwanted elements for a wp_nav_menu

I am working on building a custom mega menu within Wordpress.I am running into an issue with unwanted elements being displayed from wp_nav_menu which are distorting my menu. <?php wp_nav_menu( ...
bigant841's user avatar
  • 172
0 votes
1 answer
367 views

Adding additional html to the end of the root level in a custom nav walker

I have a custom nav walker, which essentially just add's new classes to the menu, however, my menu also contains some hard coded elements at the end (Contact button & Search Icon). Where/How to ...
ChrisBratherton's user avatar
0 votes
1 answer
34 views

Does the Default theme of Wordpress like 2016, 2017 and 2019 uses Walker_Nav_Menu Class

I want to know if these themes uses Walker_Nav_Menu class. As I open the files I can't see a Walker_Nav_Class or I could not find it. And I want to know what they use to display the Menu and Submenus. ...
Lucifer Levi's user avatar
1 vote
0 answers
1k views

Sub Menu does not display using Nav Walker

I have a submenu and I put a nav walker from a github source and my submenu does not display. Here is my code in header.php <nav class="navbar navbar-expand-md navbar-light bg-light" role="...
Lucifer Levi's user avatar
1 vote
1 answer
630 views

Get Current Menu Location inside Nav_Walker

How can I retrieve the current menu location (as registered with register_nav_menus) from inside a nav-walker class? eg: <?php class Special_Nav_Walker extends Walker_Nav_Menu { // How can ...
admcfajn's user avatar
  • 1,306
0 votes
0 answers
261 views

wordpress custom menu - show parents, siblings, children depending on depth

looking and trying for hours to find a solution for the following output of a wordpress custom menu. Hope you can help. I do not know where to start: custom menu walker, css, functions.php I have a ...
flo's user avatar
  • 21
1 vote
1 answer
1k views

start_lvl on Walker is not working

I'm creating a custom Walker to my menu, my code is like this: <?php class My_Walker extends Walker { function start_lvl( &$output, $depth = 0, $args = array() ) { $output .= "<...
Lai32290's user avatar
  • 321
0 votes
1 answer
2k views

Wrapping menu's top-level link and sub-menus in div

I'm looking for a way to wrap a menu's top-level link and sub-menus into a custom div. I found this code that almost does the trick: class Sub_Wrapper extends Walker_Nav_Menu { function start_lvl(...
Ray's user avatar
  • 25
0 votes
1 answer
200 views

Manual use of Walker_Category class

Trying to create a menu with category terms as I read in the WP docs "Using Walker Manually": https://codex.wordpress.org/Class_Reference/Walker $menu_items = get_categories(); $walk = new \...
aitor's user avatar
  • 605
0 votes
0 answers
167 views

Nav_walker add id to dropdown ul

I'm trying to add an id to the dropdown ul in bootstrap navwalker. So at the moment this is what I've got: <ul id="menu-primary-menu" class="list-unstyled components"> <...
Paulina Zawadzka's user avatar

1
2 3 4 5
8