Make WordPress Core


Ignore:
Timestamp:
10/24/2015 05:45:11 PM (9 years ago)
Author:
wonderboymusic
Message:

Nav Menus: show custom post type Archive item at the top of the View All tab for the post type on the legacy Nav Menu screen.

Props aaroncampbell, DrewAPicture, seanchayes, hlashbrooke, paulwilde, ericlewis, raulillana
See #16075.

File:
1 edited

Legend:

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

    r35170 r35382  
    494494                }
    495495
     496                $post_type = get_post_type_object( $post_type_name );
     497                $archive_link = get_post_type_archive_link( $post_type_name );
     498                if ( $post_type->has_archive ) {
     499                    $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
     500                    array_unshift( $posts, (object) array(
     501                        'ID' => 0,
     502                        'object_id' => $_nav_menu_placeholder,
     503                        'object'     => $post_type_name,
     504                        'post_content' => '',
     505                        'post_excerpt' => '',
     506                        'post_title' => $post_type->labels->archives,
     507                        'post_type' => 'nav_menu_item',
     508                        'type' => 'post_type_archive',
     509                        'url' => get_post_type_archive_link( $post_type_name ),
     510                    ) );
     511                }
     512
    496513                /**
    497514                 * Filter the posts displayed in the 'View All' tab of the current
Note: See TracChangeset for help on using the changeset viewer.