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 have created a custom post type and registered it using this code

$labels = array(
  'name' => __( 'Portfolio' ),
  'singular_name' => __( 'Portfolio' )
);

$args = array(
  'labels' => $labels,
  'public' => true,
  'exclude_from_search' => false, 
  'publicly_queryable' => true,
  'show_ui' => true, 
  'query_var' => true,
  'capability_type' => 'post',
  'hierarchical' => false,
  'menu_position' => null,
  'supports' => array('title','editor','thumbnail','custom-fields', 'page-attributes', 'excerpt', 'revisions'),
  'show_in_nav_menu' => true
);
register_post_type('portfolio',$args);

I can create a portfolio post type and save it. It all works as expected until I go to Appearance > Menus where I can add the portfolio to the menu but it wont show up in the index template using this code

wp_nav_menu(array('theme_location'=>'main_menu'));

All the other menu items show properly just not the custom post types. If you look at the screenshot, all that is shown in the front end is 'Shortcodes' link and 'BBC' link (so page and custom link - not portfolio link)

Help! I need those links in there.

Screenshot of Appearance > Menus here

screenshot

share|improve this question

2 Answers 2

Add a s to show_in_nav_menu : show_in_nav_menus

share|improve this answer
    
soju, I was very excited when I saw this and tried it. I deleted all the posts and started again with this in. No change. Still nothing. –  sl1nky Apr 18 '12 at 11:00

First you need to add the following to your $arg array

'rewrite' => array('slug' => 'portfolio')

Then you will need to create a page in wordpress admin called 'Portfolio' or any other title but as long as the page slug is 'portfolio'. Publish it.

Then go to the Appearance>Menus and add the page to your menu. Go to the frontend and go to the link in your menu and if you have any posts there you'll see a list of them - otherwise it will say that nothing has been found.

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.