First, a question: Why do you want to perform a posts query on the ‘current’ tag using query_posts() in a tag template, when that is exactly what will happen by default in a tag template?
Now for the code:
<?php
global $wp_query;
$tag = $wp_query->get_queried_object();
if( is_tag($tag->name) ) {
query_posts('tag=' . $tag->name);
}
?>
Kaf! First let me say I’m a fan. I love your plugins… especially the_excerpt_reloaded!
As for your question, first I will explain the overall objective, and this will lead into the answer to the tag query.
I’m setting up WordPress to manage my projects. I create a master-post to represent the project. Inside of the master-posts are notes/journals on the progress of the project; I was using lists, but I wanted it to be dynamic. So I picked up a plugin that allows me to create a loop within a loop through the post, i.e., the master-post. I’m using tag queries to call these sub-posts into the master-posts. Last, I wanted all latest notes/sub-posts from all projects/master-posts to show up on the project category pages, or home page if desired; most importantly I wanted sub-posts listed on the project category pages to have a reference to the original project page, where all sub-posts are listed with the formal project post, the master-post.
So… each sub-post is tagged with it’s master-project’s slug, and I thought, “There it is… I will put a conditional statement where if a tag is “example-master-post” then it queries for the “example-master-post” post.
I couldn’t get your primary script to work, but I think I needed to describe more. Anyhow, I took what you gave me and, with extreme luck/guessing, tweaked it a bit so it shows the slug. And it works! Here is is:
<?php
global $wp_query;
$tag = $wp_query->get_queried_object();
}
elseif( is_tag($tag->slug) ) {
query_posts('name=' . $tag->slug);
}
?>
Anyhow, thanks Kaf. I look up to your work.