Introduce has_nav_menu(). Returns boolean whether the theme's registered nav menu location has a menu assigned to it. props greenshady for the idea.
git-svn-id: http://svn.automattic.com/wordpress/trunk@15091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d1d63b81d5
commit
cb88a1c972
|
@ -113,6 +113,18 @@ function get_nav_menu_locations() {
|
||||||
return get_theme_mod( 'nav_menu_locations' );
|
return get_theme_mod( 'nav_menu_locations' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether a registered nav menu location has a menu assigned to it.
|
||||||
|
*
|
||||||
|
* @since 3.0.0
|
||||||
|
* @param string $location Menu location identifier.
|
||||||
|
* @return bool Whether location has a menu.
|
||||||
|
*/
|
||||||
|
function has_nav_menu( $location ) {
|
||||||
|
$locations = get_nav_menu_locations();
|
||||||
|
return ( ! empty( $locations[ $location ] ) );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether the given ID is a nav menu item.
|
* Determine whether the given ID is a nav menu item.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue