It’s pretty easy to add another custom menu to your WooCommerce pages via PHP. For example, you might want to add a list of Product Category links, and manage this through the default “Appearance > Menu” in the WordPress dashboard.

WP Dashboard > Appearance > Menu: create a new menu

Create a new menu called “Categories” and add the product categories you wish to it.

Create a new menu in WordPress

PHP Snippet: Add WP menu to WooCommerce pages


/**
 * @snippet       Add WP menu to WooCommerce pages
 * @how-to        Get CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=22012
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 2.5.2
 */

add_action( 'woocommerce_before_main_content', 'bbloomer_echo_categories_menu' );

function bbloomer_echo_categories_menu() {
wp_nav_menu( array( 'menu' => 'categories', 'container_id' => 'nav_menu-2' ) );
}

Share:

Leave a Reply