Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Not swapping menu created on archive page

$
0
0

Replies: 0

I’ve tested my conditional settings on standard menus and the plugin works fine on pre-existing locations.

However I want to create a conditional menu on an archive page which did not have a pre-defined menu location. In my functions.php file I have registered a new menu. I have created a new menu location and added the menu, which works. I used this code:

 add_action( 'woocommerce_before_main_content', 'artwork_categories_menu' );
 
function artwork_categories_menu() {
wp_nav_menu( array( 'menu' => 'artwork_categories', 'container_id' => 'artwork_categories_menu_container' ) );
 
}

This ‘hard-coded’ menu is not changed by conditional rules. I have tried an alternative method of creating a menu location (without hard-coding a menu into it) but it does not show up in my WordPress list of menu locations.

Am I going about it all wrong…?


Viewing all articles
Browse latest Browse all 59525

Trending Articles