My scenario: I have a part of a site which retrieves all post_tags terms for a specific category
the code:
query_posts('category_name='. $category[0]->cat_name);
if (have_posts()) : while (have_posts()) : the_post();
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
$all_tags_arr[] = $tag -> name;
}
}
endwhile; endif;
$tags_arr = array_unique($all_tags_arr);
foreach ($tags_arr as $cat_by_tag) {
$output_promotion .= '<li><a href="' . get_bloginfo('url'). '/' . $category[0]->cat_name . '/' . ????? . '/">'. $cat_by_tag .'</a></li>';
}
echo $output_promotion;
This all works fine, the code retrieves all post_tags and removes duplicates. I'm stuck now with the post slug. What I want is: retrieve post slug by post_tag term.
Example:
Post title: ABC Post
post slug: abc-post
Tag in that post: ABC Tag
I need something like this:
<a href="http://site/abc-post">ABC Tag</a>
Anyone can help?
Thanks in advance!