Support » Fixing WordPress » Pull Posts From a Category With A Specific Tag

  • I am trying to create an instance of the loop that pulls all posts from one category that have a specific tag which happens to be the title of the larger post that this smaller instance of the loop is on. here is the code im using:

    <?php rewind_posts(); ?>
    			<?php $tag = the_slug(); ?>
    			<?php $recent = new WP_Query("cat=755&tag=$tag&showposts=5"); while($recent->have_posts()) : $recent->the_post();?>
    			<br />
    			<?php the_content(); ?>
    			<?php endwhile; ?>

    i know the problem is my WP_Query doesn’t seem to want to take both the cat variable and the tag variable. Thanks for taking a look.

Viewing 1 replies (of 1 total)
  • shouldn’t it be:
    $recent = new WP_Query(“cat=755&tag=”.$tag.”&showposts=5″);
    to actually get the value of the tag var and not the value $tag?

Viewing 1 replies (of 1 total)
  • The topic ‘Pull Posts From a Category With A Specific Tag’ is closed to new replies.