Wordpress Custom Post Type Archive Issue -


i have blog custom post type inited like:

register_post_type( 'type',     array(         'labels' => array(             'name' => __( 'types' ),             'singular_name' => __( 'type' )         ),         'public' => true,         'has_archive' => true,     ) ); 

obviously wrapped in function called init action. problem post type full of posts, on 1k, on archive page (domain.com/type) there nothing showing. tried verify query, query showing null. have reliable solution?

ps - why hate wordpress. never works right.

tags: wordpress-broken-again, wordpress-sucks, wordpress-i-hate-you

full excerpt:

function cp_init_types() {     register_post_type( 'nursing-home',         array(             'labels' => array(                 'name' => __( 'nursing homes' ),                 'singular_name' => __( 'nursing home' )             ),             'public' => true,             'has_archive' => true,             'rewrite' => array( 'slug' => 'nursing-homes', 'with_front' => true ),             /*'supports' => array( 'title', 'editor', 'custom-fields', 'thumbnail' ),             'publicly_queryable' => true,             'exclude_from_search'=> false,             'taxonomies' => array('category','post_tag'),*/         )     );      flush_rewrite_rules( false ); }  function add_my_post_types_to_query( $query ) {     if(is_category() || is_tag() || is_home() && empty( $query->query_vars['suppress_filters'] ) ) {         $post_type = get_query_var('post_type');         if($post_type) {             $post_type = $post_type;         }         else {             $post_type = array('post','nursing-home','nav_menu_item');         }         $query->set('post_type', $post_type);         return $query;     }      return $query; }   // show posts of 'post', 'page' , 'movie' post types on home page add_action( 'pre_get_posts', 'add_my_post_types_to_query' ); add_action("init", "cp_init_types"); 

did take note of manual:

in same way single posts , archives can displayed using single.php , archive.php template files, respectively,

single posts of custom post type use single-{post_type}.php , archives use archive-{post_type}.php {post_type} $post_type argument of register_post_type() function.

http://codex.wordpress.org/post_types


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -