wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.
has_nav_menu › WordPress Function
Od3.0.0
Przestarzałyn/a
› has_nav_menu ( $location )
| Parametry: |
|
| Powrót: |
|
| Zdefiniowane na: |
|
| Codex: |
Determines whether a registered nav menu location has a menu assigned to it.
Powiązane Funkcje: is_nav_menu, wp_nav_menu, is_nav_menu_item, register_nav_menu, register_nav_menus
Źródło
function has_nav_menu( $location ) {
$has_nav_menu = false;
$registered_nav_menus = get_registered_nav_menus();
if ( isset( $registered_nav_menus[ $location ] ) ) {
$locations = get_nav_menu_locations();
$has_nav_menu = ! empty( $locations[ $location ] );
}
/**
* Filters whether a nav menu is assigned to the specified location.
*
* @since 4.3.0
*
* @param bool $has_nav_menu Whether there is a menu assigned to a location.
* @param string $location Menu location.
*/
return apply_filters( 'has_nav_menu', $has_nav_menu, $location );
}