Saturday, 10 August 2013

Wordpress loop how to get tag slug and be value in query_posts

Wordpress loop how to get tag slug and be value in query_posts

What I am trying to do is:
Among the posts in category 1 every post has a tag
Now in another post under another category I want to call the posts from
category 1 which have the same tag for example cat=1&tag=1 and cat=2&tag=1
Here is the code and it's not working:
<?php
$t = wp_get_post_tags($post->ID);
query_posts( 'cat=45&tag=' . $t. '' );
// The Loop
while ( have_posts() ) : the_post(); ?>

No comments:

Post a Comment