WordPress.org

Make WordPress Core

Changeset 14721


Ignore:
Timestamp:
05/18/2010 05:59:25 AM (8 years ago)
Author:
nacin
Message:

Inline docs for menu location functions. props jorbin, see #13378.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/nav-menu-template.php

    r14666 r14721  
    184184 * walker - allows a custom walker to be specified.
    185185 * context - the context the menu is used in.
    186  *
    187  * @todo show_home - If you set this argument, then it will display the link to the home page. The show_home argument really just needs to be set to the value of the text of the link.
     186 * theme_location - the location in the theme to be used.  Must be registered with register_nav_menu() in order to be selectable by the user.
    188187 *
    189188 * @since 3.0.0
  • trunk/wp-includes/nav-menu.php

    r14620 r14721  
    1313 * @since 3.0.0
    1414 *
    15  * @param string $menu Menu id
    16  * @return mixed $menu|false Or WP_Error
     15 * @uses get_term
     16 * @uses get_term_by
     17 *
     18 * @param string $menu Menu id, slug or name
     19 * @return mixed false if $menu param isn't supplied or term does not exist, menu object if successfull
    1720 */
    1821function wp_get_nav_menu_object( $menu ) {
     
    4245 * @since 3.0.0
    4346 *
    44  * @param int|string $menu The menu to check
     47 * @param int|string $menu The menu to check (id, slug, or name)
    4548 * @return bool Whether the menu exists.
    4649 */
     
    8891    register_nav_menus( array( $location => $description ) );
    8992}
    90 
     93/**
     94 * Returns an array of all registered nav menus in a theme
     95 *
     96 * @since 3.0.0
     97 * @return array
     98 */
    9199function get_registered_nav_menus() {
    92100    return $GLOBALS['_wp_registered_nav_menus'];
    93101}
     102
     103/**
     104 * Returns an array with the registered nav menu locations and the menu assigned to it
     105 *
     106 * @since 3.0.0
     107 * @return array
     108 */
    94109
    95110function get_nav_menu_locations() {
     
    469484            $object = get_post_meta( $item->ID, '_menu_item_object', true );
    470485            $type = get_post_meta( $item->ID, '_menu_item_type', true );
    471    
     486
    472487            if ( 'post_type' == $type )
    473488                $posts[$object][] = $object_id;
     
    475490                $terms[$object][] = $object_id;
    476491        }
    477    
     492
    478493        if ( !empty($posts) ) {
    479494            foreach ( array_keys($posts) as $post_type ) {
     
    482497        }
    483498        unset($posts);
    484    
     499
    485500        if ( !empty($terms) ) {
    486501            foreach ( array_keys($terms) as $taxonomy ) {
Note: See TracChangeset for help on using the changeset viewer.