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.

Hello can someone help me out by pointing me in the right direction as to where I can find out how to add a drop down menu to a theme with my custom post types stored within in, have been looking/searching google for "custom post types in wp_nav_menu", "custom post types in wp_list_pages", "custom post types in wordpress themes", "custom post types in wordpress theme", and have drawn a blank so far, I have managed to find out how to get my posts in the custom post types to appear in with the normal blog posts, but as I will have several posts in the custom post types more than what would be in the normal blog, would make this diluted and I would therefore like to have them in a drop down box in the menu.

The menu on this website here http://justintadlock.com/ the "Writing" part on the menu I presume that these are custom post types, but I wish to have the menu on my site like this menu, if anyone can point me in the right direction as to how to achieve this, be is something on the codex, a blog post or something like this I would very much appreciate anything anyone would be able to tell me.

share|improve this question
1  
You can add a nav menu from the Appearance > Menus section, go to screen options and check your custom post type over there. This will allow you to add your CPTs in a nav menu as you would add regular posts / pages. –  Rutwick Gangurde Oct 17 '11 at 3:21
    
I can see what you mean in screen options and have checked my custom post types here, I then get a box on the left hand side of the screen with the name of my custom post type and inside the box there is a list of all the posts I have made in the custom post type, with a check box next to each one, so I can add individual posts from the custom post type but not a link to the custom post type itself with what you have said. –  AeroMaxx Oct 17 '11 at 13:22

1 Answer 1

I took a look at Justin's 'writings' menu. I don't believe he's using custom post types for this -- I think they're just regular posts and drop down menu is displaying category archives.

Here's how you can replicate the same setup for custom post types.

Make sure your custom post types support a taxonomy, such as tags, categories or a custom taxonomy. Then expose the taxonomy items (categories, tags or any custom taxonomy) you need on the menu page. You do this using the screen options:

Screen Options for Menu Configuration Page

Note that my custom post types are not selected, but my custom taxonomy, 'topics' is selected. In my case, this taxonomy is only applied to my custom post type -- and gives me the ability to replicate the same thing as Justin is doing with my custom post type.

menu config entries

The menu dropdown entries shown include an archive listing of cpt posts matching either of two taxonomy terms (type = custom) and the more typical entry, an archive matching a particular single term (type = topic).

Your theme has to support archive listings for your custom post types. Not all themes will support them out-of-the-box.

If you're using categories or tags to do this, you need to ensure that the terms you select are only applied to your custom post type or you'll have to customize the archive template code to filter out the other post types.

Update

If you really want a single menu item that will show all your custom post types, you can link directly to the custom post type archive, like I do here:

custom post type archive listing menu item

Here's how to get that URL from your CPT registration code: Get custom post_type's archive URL

share|improve this answer

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.