How to Output a WordPress Split Menu Section

This article will demonstrate how to create WordPress split menu using JC Submenu WordPress Plugin by using either a shortcode, action, or widget.

What is a WordPress Split Menu

A WordPress Split Menu is the process of creating a multi level menu, and displaying a menu section relative to the currently viewed object/page. For Example if a site has the following menu and pages:

Page 1
 - Page 1.1
 - Page 1.2
Page 2
 - Page 1.3

Creating a split menu section for this example, you would set the start depth of 1, this means that when you are viewing any page or child page of Page 1 the split menu would output related items only:

Page 1
 - Page 1.1
 - Page 1.2

and if you were viewing any page or child page of Page 2 the split menu section would be:

Page 2
 - Page 1.3

WordPress Split Menu Widget

JC Submenu plugin comes with a widget titled “Split Menu Widget” which allows you to output your split menu within a wordpress sidebar.

It is located under Appearance > Widgets in your wordpress administration area.

JC Submenu - Split Menu Widget

JC Submenu – Split Menu Widget

Widget Settings

  • Choose Split Menu widget from the list of avaliable widgets
  • Select Menu – Choose the menu you wish to split
  • Start Level – Choose the starting depth to display
  • Menu Depth – Choose how many levels you wish to display
  • Show Parent – Choose to display the split menu’s parent item
  • Show Hierarcy – Choose to display a flat or nested list
  • Trigger Depth – Choose how many levels of children you would like to display in relation to the activate page, 0 = show all. (Added in v 0.62)

Split Menu Action

JC Submenu plugin comes with a built in wordpress action to easily output a split menu anywhere within your theme.

<?php
do_action( 'jcs/split_menu' , $menu, $args = array() );
?>
  • hierarchy – Whether to display a flat list instead
  • start – Menu depth you wish to split from
  • depth – Amount of levels you wish to display
  • show_parent – Whether to display the parent item
  • trigger_depth – how many levels of children you would like to display in relation to the activate page, 0 = show all. (Added in v 0.62)
  • menu_class – Set the class of the menu element
  • menu_id – Set the id of the menu element
  • container – what to wrap the ul in
  • container_id – Set the id of the container element
  • container_class – Set the class of the container element
  • parent_label – override the section parent with the specified string if show_parent is true