Problem with tags / labels
-
Hi.
I am developing my first wordpress theme and I have to say that I know very little of php (I know enough about html and css).
That said, my problem is the tags of the posts: when I click on any tag should be open a page where they are all posts that have the same label (tag), but I still see all posts, even those that don’t have the selected label.
I’m using the function <? php the_tags(); ?> inside de loop, the structure is like this:
<aside> <h4>Tags</h4> <ul class=”tags”> <?php the_tags( ”, ‘  –  ’, ” ); ?> </aside>No problem so far, becose I can see the tags of each post.
Inside the other single.php (which I use as a page template to view posts belonging to a specific category) I insert a query to call the posts that have the same label (tag):
<?php $args = array( ‘post_type’ => ‘post’, ‘tag’ => “ tag name ”); $query = new WP_Query($args); if ($query->have_posts()) : while($query->have_posts()) : $query->the_post(); ?>but it doesn’t work, I can’t see only posts with a specific label, I see all posts.
I hope someone can help me.
Thank you
The topic ‘Problem with tags / labels’ is closed to new replies.