• Resolved irkevin

    (@irkevin)


    Hi all,

    I’m using query_posts to show specific post from a category on the home page.. But the problem is, when I click on a post’s tags, it doesn’t bring up the associated post.

    Is there something i’m missing?

    The code Im using is below

    <?php
         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
         query_posts('cat=11&paged='.$paged);
    ?>
    <?php while (have_posts()) : the_post(); ?>
    
    Do some stuff here
    
    <?php
     endwhile;
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter irkevin

    (@irkevin)

    I also tried passing

    tag__in

    But with no luck!! Hope someone can help :S

    Thread Starter irkevin

    (@irkevin)

    Ok i got it to work.

    I’ll explain what I need in case someone else needs it

    Things I’ve noticed is:

    When using query_post, it overrides the default behaviour..

    So what i did is add a condition to check if it’s a tag. like below

    <?php
         if(is_tag()){
             $tag = get_query_var('tag');
             query_posts('tag='.$tag);
    
            while (have_posts()) : the_post();
    ?>
    Output the html along with the title here
    
    <?php
        endwhile;
    }else{
        // query_posts for your categories here
    ?>

    If I missed something, let me know

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘posts tags and query post’ is closed to new replies.