treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] WordPress: Custom Post Type not showing up in wp_nav_menus

  • I have a custom post type called Classes, but when I try to setup a sidebar menu using wp_nav_menus when I go to the Menus section under Appearance the post types do not show up, I have researched this on Google and from what I can tell all of my code is correct to allow this, any idea where I am going wrong?


    // CLASSES CUSTOM POST TYPE
    add_action('init', 'range_classes');
    function range_classes()
    {
    $labels = array(
    'name' => _x('Classes', 'tr_classes'),
    'singular_name' => _x('Class', 'tr_classes'),
    'add_new' => _x('Add New', 'tr_classes'),
    'add_new_item' => _x('Add New Class', 'tr_classes'),
    'edit_item' => _x('Edit Class', 'tr_classes'),
    'new_item' => _x('New Class', 'tr_classes'),
    'view_item' => _x('View Class', 'tr_classes'),
    'search_items' => _x('Search Classes', 'tr_classes'),
    'not_found' => _x('No Classes Found', 'tr_classes'),
    'not_found_in_trash' => _x('No Classes Found in Trash', 'tr_classes'),
    'parent_item_colon' => _x('Parent Class:', 'tr_classes'),
    'menu_name' => _x('Classes', 'tr_classes')
    );
    $args = array(
    'can_export' => TRUE,
    'capability_type' => 'post',
    'description' => 'Classes Offered.',
    'exclude_from_search' => FALSE,
    'has_archive' => FALSE,
    'hierarchical' => FALSE,
    'labels' => $labels,
    'menu_icon' => get_bloginfo('template_directory').'/images/calendar.png',
    'public' => TRUE,
    'publicly_queryable' => TRUE,
    'query_var' => 'classes',
    'rewrite' => array('slug' => 'classes'),
    'show_ui' => TRUE,
    'show_in_menu' => TRUE,
    'show_in_nav_menus' => TRUE,
    'supports' => array( 'title', 'editor', 'thumbnail' )
    );

    register_post_type('tr_classes', $args);
    }
  • Have you tried scrolling down below Pages to double check that those posts aren't showing up? Take a look at my custom post type, "Lettering". http://i48.tinypic.com/2evq001.png

    If you're trying to link to a page for the custom post type, "Classes", I don't believe you can without setting up a custom page template. See here.
  • OK, so after searching up and down it ended up being the simplest thing, under Screen Options you have to add a checkmark next to the custom post type in order for it to show up. When you go to Appearance > Menus you have to use the Screen Options drop down at the top of the screen and check the post type you want to be able to add to custom menus.