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
1 answer
11 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 ...
user avatar
1 vote
1 answer
29 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" ...
user avatar
  • 1,218
0 votes
1 answer
16 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 ...
user avatar
  • 101
0 votes
0 answers
27 views

WordPress custom menu can't show 3. level submenu

I Use a custom walker from my menu in WordPress and my menu doesn't show all levels. https://soulofcroatia.com/ ->One Day menu item. This is my code in header.php <?php ...
user avatar
0 votes
0 answers
15 views

Nav Walker that shows only children and siblings of top level parent menu item

I have a nav menu that is structured like this.. Main Section 1 – Child Link 1 -- Grandchild Link 1 – Child Link 2 – Child Link 3 Main Section 2 – Child Link 1 – Child Link 2 – Child Link 3 Lets say ...
user avatar
  • 101
0 votes
0 answers
20 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: ...
user avatar
0 votes
0 answers
27 views

Create Columns with Custom Walker and CSS Classes

I want to create a menu in WordPress that using the CSS Classes (from Screen Options) you can separate the menu by columns and choose when to start and end the column. I have this information.. &...
user avatar
1 vote
0 answers
10 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. ...
user avatar
  • 11
0 votes
0 answers
39 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', '...
user avatar
  • 247
0 votes
0 answers
19 views

How to show only the last two categories in a menu?

I am working with many categories and their sub-categories (sub items). I felt the need for a customization, but I could not achieve exactly what I wanted. Normally, categories and sub-categories are ...
user avatar
0 votes
1 answer
153 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="...
user avatar
  • 1,913
0 votes
1 answer
70 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 ...
user avatar
0 votes
1 answer
53 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 ...
user avatar
  • 103
1 vote
1 answer
136 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 ...
user avatar
0 votes
1 answer
85 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 ...
user avatar
  • 1
1 vote
0 answers
28 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 ...
user avatar
0 votes
0 answers
57 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 ...
user avatar
0 votes
0 answers
21 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 ...
user avatar
  • 1
0 votes
1 answer
26 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 >...
user avatar
1 vote
1 answer
181 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 ...
user avatar
1 vote
0 answers
40 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 /...
user avatar
0 votes
1 answer
192 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 ...
user avatar
1 vote
0 answers
39 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, ...
user avatar
1 vote
2 answers
94 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 ...
user avatar
  • 11
0 votes
1 answer
319 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-...
user avatar
  • 103
0 votes
1 answer
80 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 = ''; ...
user avatar
0 votes
1 answer
23 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 ...
user avatar
0 votes
1 answer
837 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' =&...
user avatar
  • 267
0 votes
0 answers
85 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 ...
user avatar
  • 1
0 votes
2 answers
544 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 ...
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 ...
user avatar
  • 1
0 votes
0 answers
164 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); ...
user avatar
  • 193
0 votes
0 answers
55 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 ...
user avatar
1 vote
0 answers
35 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'...
user avatar
  • 111
2 votes
1 answer
871 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 ...
user avatar
0 votes
1 answer
19 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 ...
user avatar
0 votes
0 answers
68 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 <...
user avatar
0 votes
1 answer
217 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 ...
user avatar
0 votes
1 answer
207 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
user avatar
0 votes
0 answers
644 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> &...
user avatar
1 vote
1 answer
180 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( ...
user avatar
  • 172
0 votes
1 answer
239 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 ...
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. ...
user avatar
1 vote
0 answers
877 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="...
user avatar
1 vote
1 answer
362 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 ...
user avatar
  • 1,213
0 votes
0 answers
166 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 ...
user avatar
  • 21
1 vote
1 answer
719 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 .= "<...
user avatar
  • 321
0 votes
1 answer
1k 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(...
user avatar
  • 25
0 votes
1 answer
165 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 \...
user avatar
  • 461
0 votes
0 answers
93 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"> <...
user avatar

1
2 3 4 5
8