I created a custom post type called portfolio and registered a custom taxonomy called project-categorywhich work just fine. The problem is that I created a archive.php file to handle how each category should look and if I place the regular WP loop:
<?php if (have_posts()) while (have_posts()) : the_post(); ?>
<h1><?php the_title() ?></h1>
<?php endwhile; ?>
It doesn't do anything, but if I add the query_string global and concatenate the post type portfolio it works fine:
<?php global $query_string; query_posts($query_string . '&post_type=portfolio'); ?>
<?php if (have_posts()) while (have_posts()) : the_post(); ?>
<h1><?php the_title() ?></h1>
<?php endwhile; ?>
Why does this happen? The query_string contains 'project-category=abc' which should be enough to display my posts I shouldn't need to add the post type. I'm getting some errors with pagination too and I think it might be related to this, any help would be appreciated.
Thanks in advance!