Tag Info

New answers tagged

0

What i have understand that you want to change the class of all li element to be what you want try this class myWalker extends Walker_Nav_Menu { function start_lvl(&$output, $depth = 0, $args = array()) { $output .= "\n".'<li class="your_custom_class" id ="your_custom_id>'."\n"; } function end_lvl(&$output, $depth = 0, ...


0

I had a similar problem and here is the best solution I could come up with. The reason (I think) that private or non-published items show up in menus is that the menu items are themselves posts and have their own post_status. That means that in a situation where a page is marked private, the menu item for that page can still be set to publish, and is ...


0

Flexibility & cleanliness. Walker-based classes are an excellent way to generate custom output based on any branched data object. They keep your code lean, mean, and easily readable. You can define output for the start and end of each "branch" (any menu item with sub-menu items) as well as the start and/or end of each individual node/menu item. It's my ...


0

Use the default walker, it covers 99.999999999999.... ... 999999999999% of instances via its filters, and it's maintained by someone smarter than both of us, and used by a lot of people. If you need to do something that requires modifying the walker, use a subclass. Otherwise you're going to lose compatibility with anything that uses the walker filters, ...


1

I would say mostly you see the usage of wp_nav_menu(), which does use wp_get_nav_menu_items(). You can use wp_nav_menu() with the default walker or a custom walker. To be honest I can't remember the time I did a menu manually, with wp_get_nav_menu_items() or something else, and I tend to be lazy, so this is definitely more work. The Walker Class gives ...


1

In that case, you should try below .nav-holder { display: none; } on media.css line no. 115


0

We can change the default behaviour of including posts attached to child categories by mapping the category_name query var (set from pretty permalinks) to category__in (which ignores child categories): function wpse_184127_ignore_category_children( $wp_query ) { if ( $wp_query->is_main_query() && $wp_query->is_category() && $name = ...


2

I guess you mean the wp_page_menu fallback, where you can use the filters wp_page_menu_args and wp_page_menu to modify it's output. Notice that this function is a wrapper for the wp_list_pages() function, that ships with the wp_list_pages_excludes and the wp_list_pages filters. That function is again wrapper for the walk_page_tree() function, that ...


0

Hate to answer my own question, but I fixed it. Seems the issue was with how the pages were getting added to the menu via the WordPress admin. After removing and adding them back, the sidebars appeared just fine. So, in the event someone else has a similar problem, just delete the pages and re-add them.


0

Replace $page->post_title; with $item->title; to get the menu item's label



Top 50 recent answers are included