Customize Category Menu for the Vantage theme

The Vantage theme allows displaying category mega menu in the navigation bar and on the dedicated Categories page.

Vantage Category Menu
Vantage Category Menu

Currently, there are no options for customization Category menu, but fortunately it has all necessary hooks and filter for that.

The filter “va_listing_categories_{$location}_args” allows changing parameters and alternate category menu for navigation and categories page separately. Dynamic part {$location} determines the location of the menu to apply changes for:

  • va_listing_categories_dir_args – applies changes to menu on the Categories page.
  • va_listing_categories_menu_args – applies changes to the navigation mega menu.

Filter ‘va_listing_categories_{$location}_args’

Basic parameters

  • 'menu_cols'(int) Columns number. Default 2 for page or 3 for navigation menu.
  • 'menu_depth'(int) Number of sub categories levels. Default 3.
  • 'menu_sub_num'(int) Max number of subcategories. Default 3.
  • 'cat_parent_count'(bool) Whether to display listing count for the parent categories. Default true.
  • 'cat_child_count'(bool) Whether to display listing count for the sub categories. Default true.
  • 'cat_hide_empty'(bool) Hide empty categories. Default false.
  • 'cat_nocatstext'(bool) Display no categories text. Default true.
  • 'taxonomy'(string) The taxonomy name. Default ‘listing_category’.

Below parameters that change menu items HTML

Entries like '%s' or '%1$d' are the placeholders, they will be replaced with actual text on the rendering.

  • 'column_wrapper'(string) Column wrapper. Default no wrapper, only placeholder '%s'.
  • 'main_list_wrapper'(string) Menu wrapper. Default no wrapper, only placeholder '%s'.
  • 'main_item_wrapper'(string) Menu item wrapper. Default '<div class="parent-cat-wrap column column-block"><div class="parent-cat cat-item-%1$d"><a href="%2$s">%4$s%5$s</a></div><!-- .parent-cat -->%6$s' . "\r\n</div><!-- .parent-cat-wrap -->\r\n".
  • 'sub_list_wrapper'(string) Sub menu wrapper. Default '<div class="sub-cat-list">%s' . "</div>\r\n".
  • 'sub_item_wrapper'(string) Sub menu item wrapper. Default '<div class="cat-item cat-item-%1$d"><a href="%2$s">%4$s%5$s</a>%6$s' . "</div>\r\n".
  • 'count_wrapper'(string) Listings count wrapper. Default ' <span class="cat-item-count label">%d</span>'.
  • 'nocats_wrapper'(string) No categories’ wrapper. Default '<div class="sub-cat-list"><div class="cat-item">%s' . "</div>\r\n</div>\r\n".

Customize Category Menu examples

Examples provided with code snippets which you can add in a custom plugin or child theme functions.php file. Alternatively, Code Snippets plugin can be used (more details in the instruction).

1. Change number of sub categories

function my_va_increase_sub_cats( $args ) {
	$args['menu_sub_num'] = 10;
	return $args;
add_filter( 'va_listing_categories_menu_args', 'my_va_increase_sub_cats' );
add_filter( 'va_listing_categories_dir_args', 'my_va_increase_sub_cats' );