• Hi all,

    I’ve set up a custom post type (store) and the posts are displaying in the list page fine. I’ve also added a category menu so users can filter the product list based on categories. For some reason, however I cannot get any posts displaying in the ‘post type archive’ – its just uses the default archive page.

    I’ve got a archive-store.php file but it’s ignored. I wondered if I’m missing something. I’m using the ‘custom post types’ plugin and also added the following (found elsewhere on this forum) to functions.php as previously nothing was displaying.

    add_filter('pre_get_posts', 'query_post_type');
    function query_post_type($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','store','nav_menu_item');
        $query->set('post_type',$post_type);
    	return $query;
        }
    }

    The posts display fine using archive.php, but I would prefer if I could get them to display using the custom archive template. Any ideas?

  • The topic ‘Customr Post Type archive template’ is closed to new replies.