Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm wondering how it's possible to add custom post type categories as an option to add as a navigation menu item.

What I have:

$portfolio_args = array(
    'labels' => array(
        'name' => 'Portfolio Items',
        'singular_name' => 'Portfolio Item'),
    'description' => 'Allows you to build custom portfolio items and link them to categories',
    'public' => true,
    'show_ui' => true,
    'menu_position' => 20,
    'supports' => array('title', 'editor', 'thumbnail'),
    'has_archive' => true,
    'rewrite' => array('slug' => 'portfolio-item'),
    'can_export' => true
);

// http://codex.wordpress.org/Function_Reference/register_post_type
register_post_type('portfolio', $portfolio_args);

$categories_labels = array(
    'label' => 'Categories',
    'hierarchical' => true,
    'query_var' => true
);

// Register taxonomies for extra post type capabilities
register_taxonomy('portfolio_categories', 'portfolio', $categories_labels);

Which works fine. I can create new categories for that specific post type. What I want to do is be able to go to wp-admin/nav-menus.php, scroll to the bottom and on the left, see the categories listed under 'Categories'.

Any ideas? Thanks.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

If you don't see your taxonomy, check under the Screen Options tab in the upper-right corner of the admin window and make sure the Show on screen check box is ticked for that taxonomy.

share|improve this answer
    
Hey Milo, thanks. So apparently I had to open up Screen Options and check 'Portfolio Items'... (the name of the registered post type) for them to actually show. Is that normal behavior or should the categories automatically be listed within the categories section at the bottom? –  mousesports Nov 1 '12 at 0:25
    
Oh ok, I see what happened. There is another 'Categories' that I can select that is related to my custom post type. That fixed it thanks. –  mousesports Nov 1 '12 at 0:27
    
Is there a way then to automatically show either the 'Portfolio Items' or 'Categories' by default? –  mousesports Nov 1 '12 at 0:28
    
I'm not too familiar with how that part of the UI works. I believe the screen options are saved per-user as user meta data, and I've experienced some seemingly random behavior like you have, with it being hidden for a user but not another. I'll have to look into it more to see exactly how it works. –  Milo Nov 1 '12 at 0:32

You should already see this taxonomy on the bottom left under nav-menus, it works in the default them or any theme that supports register_nav_menu

I highly suggest you change the name for 'label' => 'Categories', to something else, the default category meta box shows exactly this name already.

In order for the actual taxonomies to show up, you need to create some items for it and tag some post to it, or you can select "View All".

For example: I took your example and pasted it into twentyeleven and changed the label to "cats".

enter image description here

share|improve this answer
    
That's strange. It must be the theme I'm building but I don't really know what would have caused this conflict. –  mousesports Nov 1 '12 at 0:24
    
Ah lol see Milo's answer this one gets everyone. –  Wyck Nov 1 '12 at 0:26
    
I actually do/did see the Categories tab, except my Most Used and View All were empty. –  mousesports Nov 1 '12 at 0:26
    
I suggest changing the name, that label is already used in wordpress and might cause problems, and making some test terms and posts in this category. Also turn on debugging. –  Wyck Nov 1 '12 at 0:29
    
Great, just did. Thanks! Do you know if there's a way to automatically show either the 'Portfolio Items' or 'Categories' by default so the user doesn't have to select screen options > whatever? –  mousesports Nov 1 '12 at 0:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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