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 $tree_type=”comment”; var $db_fields = array( ‘parent’ => ‘comment_parent’, ‘id’ => ‘comment_ID’ ); // constructor – wrapper for the comments list function __construct() { … Read more

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 list item in one of my theme’s menus. The taxonomy is hierarchical, and I would like to add all … Read more

Sub-Pages only of menu items in current branch using a custom menu

Although I did a thorough research I could not find a solution. Only solutions coming close. My custom menu (“top”) shows this structure (you see a part of it): page 1 subpage 1.1 category A subsubpage 1.1.1 subsubpage 1.1.2 subpage 1.2 category B subsubpage 1.2.1 subsubpage 1.2.2 subpage 1.3 category C subsubpage 1.3.1 subsubpage 1.3.2 … Read more

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( ‘menu’ => 3, ‘container’ => false ) Which gives me: <div class=”menu-wrap”> <ul id=”menu-menu” class=”menu”> <li id=”menu-item-979″ class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-979″><a href=”#”>Homepage</a></li> <li id=”menu-item-844″ class=”menu-item menu-item-type-post_type menu-item-object-page … Read more

how to change WordPress menu markup/classes

I’m building my first website on WordPress, and i wanted to ask is someone know how to change markup in WordPress menu. Basically I want the markup of my WordPress navigation to match what I’ve done in my static templates. <div class=”topNav”> <ul> <li><a href=”#”>About</a></li> <li><a href=”#”>Mes siūlome</a></li> <li class=”dropdown”> <a class=”dropbtn”>if Has subMenu</a> <div … Read more

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 Item</a></li> <li><a>Some Child Item</a></li> </ul> </li> <li><a>Second Item</a></li> <li><a>Third Item</a></li> </ul> I’m trying to add the parent item’s title to the sub-menu section. So, I’m trying to achieve this: <ul> <li><a>First Item</a> <ul class=”sub-menu”> <h3>First Item</h3> <!– … Read more

Editing or filtering the output of the Genesis navigation

I’m trying to edit or apply a filter to the default Genesis navigation genesis_do_nav Currently I’m extending a Walker class to add a <span> with data-attribute around the navigation’s link text. class Menu_With_Data_Attr extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { global $wp_query; $indent = ( $depth ) ? str_repeat( “\t”, $depth ) : … Read more