1

I recently adjusted the twentyten theme to display archives in a three column grid. In doing so, it seems that the archive has lost the ability to display posts from the specified taxonomy.

For instance, a taxonomy type is 'Flowers', with a specific flower being 'Rose'. When the 'Rose' archive is displayed, it simply lists all posts. I believe I have narrowed the problem to this line:

query_posts('cat=0&posts_per_page=12&paged='.$paged);

I understand that it is just listing all 'uncategorized' posts, but I am at a loss with how to have display a specific taxonomy archive as would normally be done for a category archive.

Any ideas? I am guessing it isn't as hard as I am making it, but I have searched for hours with no luck.

Thanks in advance!

1
  • 1
    Try just removing the line.
    – Milo
    May 10, 2011 at 21:42

2 Answers 2

4

you can add the current term to you query so if its category, tag or custom taxonomy you will get the posts with the current term, try changing this:

query_posts('cat=0&posts_per_page=12&paged='.$paged);

with this:

$term_slug = get_query_var( 'term' );
$taxonomyName = get_query_var( 'taxonomy' );
query_posts(array('posts_per_page' => 12, 'paged' => $paged, $taxonomyName => $term_slug));
0
-1

+1 to Milo answer. But if you need to change the post_per_page parameter, try this:

global $query_string;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts($query_string.'&paged='.$paged.'&posts_per_page=12');
1
  • I understood that you needed archive for a custom post type, not a taxonomy. Sorry!
    – MZAweb
    May 11, 2011 at 1:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.