_x( 'CPTs', 'post type general name' ), 'singular_name' => _x( 'CPT', 'post type singular name' ), 'add_new' => _x( 'New CPT', 'add new singular name' ), 'add_new_item' => __( 'Add New CPT' ), 'edit_item' => __( 'Edit CPT' ), 'new_item' => __( 'New CPT' ), 'view_item' => __( 'View CPT' ), 'search_items' => __( 'Search CPTs' ), 'not_found' => __( 'No CPTs Found' ), 'not_found_in_trash' => __( 'No CPTs found in Trash' ), 'parent_item_colon' => '-:-' ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'cpt', 'with_front' => true, 'feeds' => false, 'feed' => false, 'pages' => true, 'ep_mask' => 0 //(EP_ROOT) ), 'has_archive' => 'cpts', 'capability_type' => 'post', 'hierarchical' => true, 'show_in_nav_menus' => true, 'menu_position' => 100, // last block 'supports' => array( 'title', 'editor', 'excerpt', //'comments', 'revisions', 'page-attributes', 'shortlink' ) ); register_post_type( 'cpt', $args ); } } // end register_cpt } // end class cpt /* put this in your side bar */ function list_cpts( $args = array() ) { global $post; $default_args = array( 'post_type'=>'cpt', 'title_li'=> __('CPTs') ); if ( is_single() && ( 'cpt' == $post->post_type ) ) { if ( $parent_id = wp_get_post_parent_id( $post->ID ) ) { $default_args['child_of'] = $parent_id; // get siblings } else { $default_args['child_of'] = $post->ID; // get children } } $args = array_merge( $default_args, $args ); return wp_list_pages( $args ); }