Here is my situation.
In my home page, I want to have the list of all existing tags and use them as filter for an isotope grid containing posts.
So for each post I already check the associated tags and output them as class name on the post grid-item for filtering.
I have an hard time getting the list of all my existing tags. I think it should be easy stuff to do. What am I missing?
This is an example:
$tags = get_tags();
$html = '<div class="post_tags">';
foreach ( $tags as $tag ) {
$tag_link = get_tag_link( $tag->term_id );
$html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
$html .= "{$tag->name}</a>";
}
$html .= '</div>';
echo $html;
Example taken from here: https://codex.wordpress.org/Function_Reference/get_tags
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With