Forums

[resolved] Query in category page doesn't work with tag (3 posts)

  1. jumust
    Member
    Posted 3 months ago #

    Here it's what I have in category.php

    <?php
    if (have_posts()) : while (have_posts()) : the_post();
    ?>
    CONTENT
    <?php endwhile; endif; ?>

    I want to show for each category only posts that have a specific tag="big"

    so I put right before CONTENT
    <?php query_posts( 'tag=big' ); ?>

    but suddenly it shows only the last recent post, which also doesn't have the tag=big

    What's wrong?

  2. alchymyth
    The Sweeper
    Posted 3 months ago #

    you are simply totally overwriting the default query with your code;

    have a look at:
    http://codex.wordpress.org/Function_Reference/query_posts#Usage_Note

    example:

    <?php global $query_string; query_posts( $query_string . '&tag=big' ); ?>

    (untested)

  3. jumust
    Member
    Posted 3 months ago #

    Perfect Thanks!
    It worked like a charm

Reply

You must log in to post.

About this Topic