Articles of the tags

the_tags : can we insert a class

<?php the_tags( ‘<ul><li>’, ‘</li><li>’, ‘</li></ul>’ ); ?> when we use the above we get this kind of HTML → <ul> <li><a href=”http://……./tag/first-lady/” rel=”tag”>first lady</a></li> <li><a href=”http://………/tag/ivanka/” rel=”tag”>ivanka</a></li> <li><a href=”http://……../tag/sexy/” rel=”tag”>sexy</a></li> </ul> Is it possible that within the anchor tag we can insert a class like this → <li><a href=”http://………/tag/ivanka/” rel=”tag” class=”my_custom_class”>ivanka</a></li> Reference →

the_tags() : display the tags by the order they are typed in in the backend, not alphabetically

I’m using WordPress’ the_tags() to display the tags of each post on a single side. What I intend to do is to display the tags by the order they are typed in in the backend, and not by alphabetical order. The WordPress codex doesn’t seem to have an argument to sort the_tags() and the output […]

How to not show tags if the post doesn't have any?

I currently have the following trying to avoid showing tags (the icon in this case) when there aren’t any, but the icon continues to show up. Any thoughts? <?php if ( is_singular() && function_exists(‘the_tags’) ) : ?> <p><i class=”icon-tags”></i><?php the_tags(”, ‘, ‘, ‘ ‘); ?></p> <?php endif; ?>

Post tags show outside loop?

I’m trying to use tags of the single post, as meta keywords. I tried using this: <meta name=”keywords” content=”<?php the_tags(”,’,’,”);?>test<?php }?>”/> It works, but the output is: <meta name=”keywords” content=”<a href=”” rel=”tag”>aquaman</a>,<a href=”” rel=”tag”>batman</a>,<a href=”” rel=”tag”>wonder woman</a>”/> Is it possible to remove the tags link/URL? And just the text/tag itself will appear?

How to display the_tags() as plain text

the_tags by default is displaying as URL. I need to display it as plain text to insert inside HTML attribute. <?php $tag = the_tags(”); ?> <div class=”image-portfolio” data-section=”<?php echo $tag ?>”>