Have you tried using get_the_tags()?
Thank you for your reply but i’ve already tried get_the_tags()
What i want to show is total tag count for a post. If anybody knows the code please paste it as a reply, thank you…
What i want to show is total tag count for a post.
– I guess I’m not understanding what you’re trying to do.
For example, say a post is tagged “WordPress”, “CMS”, and “PHP”. Are you wanting to display something like “This post has 3 tags”?
If that is the case the get_the_tags() will work since it returns an array of objects, one object for each tag assigned to the post. Have you tried something like:
$post_tags = get_the_tags();
$tag_count = count($post_tags);
if ( $tag_count ) {
echo "This post has $tag_count tags";
}
else {
echo "This post does not have any tags";
}
Hi, thank you for your reply and help, i’ve pasted the code above but i’m always having “This post does not have any tags” message even for tagged posts. I think code need to be modified.
Without seeing the code in context it’s hard to say why it’s not working. Can you paste the entire file into a pastebin and then post that link here?