You are currently browsing the archives for the menu category


wp nav menu undocumented paramater

‘items_wrap’ => ‘<ul id="%1$s">%3$s</ul>

This is executed by: $nav_menu .= sprintf( $args->items_wrap, esc_attr( $wrap_id ), esc_attr( $wrap_class ), $items );

you can play around with the sprintf arguments

ex: ‘items_wrap’ => ‘%3$s’ would remove the wrapping <ul> tag

Get menu name from menu location

<?php
function wpexpo_get_theme_menu_name( $theme_location ) {
	if( ! $theme_location ) return false;

	$theme_locations = get_nav_menu_locations();
	if( ! isset( $theme_locations[$theme_location] ) ) return false;

	$menu_obj = get_term( $theme_locations[$theme_location], 'nav_menu' );
	if( ! $menu_obj ) $menu_obj = false;
	if( ! isset( $menu_obj-&gt;name ) ) return false;

	return $menu_obj-&gt;name;
}
?>

Tags