0

random problem for me here. I have several custom post types registered to Wordpress and I want to add the archive pages to the menu, but I do not want them to be static links.

Is there any way to add the custom post types to the Wordpress menu via plugin etc and have the hiearchical menu classes stuff work nicely?

E.G I have a jobs CPT which I want to just add a jobs menu item for which will just link to the archive for that CPT.

| improve this question | | | | |
0

Use the param 'show_in_menu' in the function register_post_type() to add this CPT to the menu. Also it is possible to use as submenu in a existing or created menu item. Now a example to add this as submenu in a existing Custom Post Type.

// This custom post type will be added as a submenu to the 'Portfolio' menu
$args = array(
  'labels' => array(
        'all_items'           => 'Locations',
        'menu_name'           => 'Locations',
        'singular_name'       => 'Location',
        'edit_item'           => 'Edit Location',
        'new_item'            => 'New Location',
        'view_item'           => 'View Location',
        'items_archive'       => 'Location Archive',
        'search_items'        => 'Search Locations',
        'not_found'           => 'No locations found.',
        'not_found_in_trash'  => 'No locations found in trash.'
    ),
    'supports'      =>  array( 'title', 'editor', 'revisions' ),
    'show_in_menu'  =>  'edit.php?post_type=portfolio',
    'public'        =>  TRUE
);
register_post_type( 'location', $args );
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.