I have a function that displays the current posts tags in a dropdown that opens the category page onselect. However, I thought the code would also work for tags, but for some reason it does not. Here is the category dropdown code.
function drop_cats()
{
echo "<select onChange=\"document.location.href=this.options[this.selectedIndex].value;\">";
echo "<option>Categories</option>\n";
foreach (get_the_category() as $cat)
{
echo "<option value=\"";
echo get_category_link($cat->cat_ID);
echo "\">".$cat->cat_name."</option>\n";
}
echo "</select>";
}
Here is my attempt at the tags one, but no go.
function drop_tags()
{
echo "<select onChange=\"document.location.href=this.options[this.selectedIndex].value;\">";
echo "<option>Tags</option>\n";
foreach (get_the_tags() as $tag)
{
echo "<option value=\"";
echo get_tag_link($tag->tag_ID);
echo "\">".$cat->cat_name."</option>\n";
}
echo "</select>";
}