How do I pass an argument to my custom walker?

Native walker are triggered with walk() method and are not set up to receive data on creation. You can define custom property and constructor method for this purpose: class plus_walker extends Walker_Nav_Menu { var $refine; function __construct($refine) { $this->refine = $refine; } } //stuff ‘walker’ => new plus_walker(‘review’); After this you can access your custom … Read more

Using filters to change href of nav menu page link

You are on right track, with few minor kinks. You need to modify $atts and return it. Any arguments after the first one are provided for information and should not be changed. You need to tell add_filter() that you expect more than one argument. The example with some debug code would be along the lines … Read more

Large WP 3.0 menu times out and won’t save

You can always try to split your menu into 2 separate menus and then just display them next to each other in your theme. It’s far from perfect and doesn’t help a bit in understanding the root of your problem but it could help. You can use it as temporary workaround to GTD before deadline … Read more

How to move parent li to end of child ul

Since this is a stylistic change, and not looking to reorder the DOM for semantic reasons, I think the js solution wouldn’t be the best approach. Better to keep it in CSS, keeping the markup intact. Two ways to do it: Flexbox: #generalinfo{ display: flex; flex-direction: column-reverse; } CSS Grid: #generalinfo{ display: grid; } .cat{ … Read more

How to include the ‘current-menu-ancestor’ class on a custom post type menu in WordPress?

This is the final working code: <?php function additional_active_item_classes($classes = array(), $menu_item = false){ global $wp_query; if(in_array(‘current-menu-item’, $menu_item->classes)){ $classes[] = ‘current-menu-item’; } if ( $menu_item->post_name == ‘product’ && is_post_type_archive(‘product’) ) { $classes[] = ‘current-menu-item’; } if ( $menu_item->post_name == ‘product’ && is_singular(‘product’) ) { $classes[] = ‘current-menu-item’; } return $classes; } add_filter( ‘nav_menu_css_class’, ‘additional_active_item_classes’, 10, … Read more

Bootstrap dropdown nav pills not working with wp_nav_menu()

I ran into similar problem when I created a bootstrap navigation menu and dropdown links were all showing up at once. I used the following steps to correct the issue: download navwalker from github repo link: https://github.com/wp-bootstrap/wp-bootstrap-navwalker put this file in the root folder of the theme and in the functions.php file userequire_once get_template_directory() . … Read more

Menu Disappears on Category Pages

I know this is an old question but seems that is still unresolved. As @Milo said you may have an incorrect pre_get_posts implementation. Most people do this like this (example): add_filter( ‘pre_get_posts’, ‘query_post_type’ ); function query_post_type( $query ) { if ( is_category() ) { $post_type = get_query_var( ‘post_type’ ); if ( $post_type ) { $post_type … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)