[wp-trac] [WordPress Trac] #16075: Add Post Type Archives support in Nav Menus

WordPress Trac noreply at wordpress.org
Wed Sep 2 20:59:12 UTC 2015


#16075: Add Post Type Archives support in Nav Menus
-------------------------------------------------+-------------------------
 Reporter:  matzipan                             |       Owner:
     Type:  enhancement                          |  aaroncampbell
 Priority:  normal                               |      Status:  assigned
Component:  Menus                                |   Milestone:  4.4
 Severity:  normal                               |     Version:  3.1
 Keywords:  has-patch ui-feedback needs-testing  |  Resolution:
                                                 |     Focuses:
-------------------------------------------------+-------------------------
Changes (by aaroncampbell):

 * keywords:  has-patch ui-feedback => has-patch ui-feedback needs-testing


Comment:

 [attachment:16075.6.diff] is based on a short conversation in Slack.
 Instead of using the `all_items` label for a post type, it adds a new
 `archives` label. The `archives` label will default to the `all_items`
 label if not specified and if no labels are given it will use either "Post
 Archives" or "Page Archives" depending on if the post type is
 hierarchical.

 It also adds a checkbox, using the new archives label, to the top of the
 View All tab for any post type that has an archive.

 It adds a new menu item type of `post_type_archive`, which stores the
 post_type as the object, so that the url can be pulled using
 `get_post_type_archive_link( $menu_item->object )` instead of being stored
 like custom menu items. This way, if a site changes permalink structure,
 the link stays correct just like post links do.

 Lastly, it adds the `current-menu-item` class to the menu item if
 `is_post_type_archive( array( $menu_item->object ) )`.

 I still don't love the UI. It's not obvious to find it in the all items
 tab, I'm just not sure where else to put it.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/16075#comment:94>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list