Using Title/Permalink as a Tag for Querying Posts
-
I am trying to create a query on child pages that will display all posts in a certain category tagged with the title of that child page.
IE: On each artist’s page, it will display each release by that artist (a post in a category titled “releases”, tagged with that artist’s name).
http://dev.lukeshumard.com/blackcity/artists/future-ghosts/
http://dev.lukeshumard.com/blackcity/artists/vx/Right now, the code is set up so that it will query posts from the correct category ID (4), but only posts tagged with one artist name (vx). I want this tag to be changed depending on which artist page you are on. I have tried using something like…
$bandreleases = the_title(); if (have_posts()) : query_posts("cat=4&tag=$bandreleases");…but this doesn’t work. I think that it is because it’s in a different query as the page query.
Here is my code at the moment, with just the tag ‘vx’.
<?php if (have_posts()) : query_posts("cat=4&tag='vx'");?> <?php while (have_posts()) : the_post(); ?> <?php $values = get_post_custom_values("catalog_thumb"); if (isset($values[0])) { ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><img src="<?php $values = get_post_custom_values("catalog_thumb"); echo $values[0]; ?>" alt="" /></a> <h4><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4> </div> <?php } ?> <?php endwhile; ?> <?php else : ?> <?php endif; ?>I don’t want the code to be done for me, but any ideas as to how this might be possible would be greatly appreciated. Thank you.
The topic ‘Using Title/Permalink as a Tag for Querying Posts’ is closed to new replies.