Short-codes

You can use the short code [menu] in any post content. It accepts the parameters below.
A short code [submenu] is also available, it is a shortcut for the [menu] short-code with the start_from parameter set to ‘current’ as default.

Example: [submenu thumbnail=medium show_description=1 menu=6]

Templates action

In your themes, you can use the gk-menu action anywhere:

do_action('gk-menu', $parameters);

$parameters being a set of the parameters below as an array, or a query string.

Parameters

menu
The menu to display. Accepts (matching in order) id, slug, name. Defaults to the menu having the lowest ID.
start_from
To display a portion of a menu, specify here the menu item ID you want your menu to start from. You can set it to:

  • ‘current’ for the menu to start from the currently viewed page
  • ‘parent’ for the menu to start from the currently viewed page’s parent menu Item
  • ‘top’ for the menu to start from the currently viewed page’s top parent menu Item

Default: 0, displays the full menu.BETA – you can also specify a post or a term ID that exists in the chosen menu. The plugin will guess to witch menu item that post or term is linked from. If you set a term ID, do not forget to set the ‘type‘ argument bellow to ‘taxonomy’.

type
BETA – set it to ‘taxonomy’ if you specify a term ID as the start_from parameter. Default to ‘post_type’
depth
How many levels of the hierarchy are to be displayed.
Default to 0 (no limit)
show_description
Shows the description of each menu item using the description field set in wp-admin or the excerpt for auto populated menu entries.

TIP: activate page’s excerpt using that simple code in your theme’s functions.php file:

add_post_type_support( 'page', 'excerpt' );

NOTE: you can use any other parameters used by the wp_nav_menu() function.

Parameters filter hooks

Gecka Submenu provides those filter:

gk_submenu_widget_args
Allow to filter the submenu widgets parameters
gk_submenu_args
Allow to filter the parameters of the submenus generated using the short-codes or the template action hook.

Comments are closed.