Custom Category Archive not Showing All Posts
-
Hello All,
I have setup custom category archive pages for each category on my site. I have custom post type ‘Artists’ and category ‘Bands’, however when displaying the category archive for ‘Bands’ not all of the Bands show up on the page, and I can not figure out why.
This is the opening code for my category archiveget_header(); ?> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <?php if ( have_posts() ) { while ( have_posts() ) { the_post(); $wp_query->the_post();
I then used pre_get_posts to pull the correct category
function set_category_query($query) { if((is_category() || is_tag()) && $query->is_main_query()) { $post_type = get_query_var('post_type'); $query->set('orderby','title'); $query->set('order','ASC'); if ( is_category('bands')) { $query->set('post_type','artists'); $query->set('cat','bands'); } elseif($post_type) { $post_type = $post_type; } return $query; } } add_filter('pre_get_posts', 'set_category_query');
There should be a band listed right at the beginning as ’10 Minutes Down’ however that band does not show on the Bands Category Archive page.
Any suggestions would be greatly helpful!!
Thanks!The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom Category Archive not Showing All Posts’ is closed to new replies.