Get post sulg and use it for a variable in multiple loops… ?
-
Ok… I don’t know if I can do what I wanna do! ??
When I’m on my single.php, meaning I’m reading a particular post, I would like to get the post-slug of the post i’m reading and use it as a variable in query_posts later in the page.
I wanna use the post-slug of a particular posts as a tag in other posts, wich are relative to this post…
Example :
I’m reading the post XYZ, with the post-slug XYZ. So I have a first loop to display it:
<?php while (have_posts()) : the_post(); ?> Display the post's stuff <?php endwhile; ?>
Then,on this same page, after this first loop, I want to put other loops to display all posts using the post-slug of the first post as a tag…
<?php query_posts(array( 'tag_slug__and'=>array('the-slug-of-the-post-looped-above '), ) ); ?>
Or
<?php query_posts('tag=the-slug-of-the-post-looped-above'); ?>
Don’t know if I’m clear enough… ?? It is possible ?
Thanks.
S.
- The topic ‘Get post sulg and use it for a variable in multiple loops… ?’ is closed to new replies.