WordPress.org

Ready to get started?Download WordPress

Forums

How to sort a list of tags in a post (1 post)

  1. mikonium
    Member
    Posted 3 years ago #

    Hi everyone,

    The front page of my site displays the most recent posts and a single one of the post's tags. Currently, the single tag is just whatever is first alphabetically, however I would like to be able to assign which tag is most important so that it can be shown on the front page. Is there any way to do this?

    I am using this code to display the single tag:

    <?php
    					$posttags = get_the_tags();
    					$count=0;
    					if ($posttags) {
    					foreach($posttags as $tag) {
    					$count++;
    					sort($posttags);
    					if (1 == $count) {
    					echo '#' . $tag->name;
    					}}}?>

    If there is no way to manually select a tag to display, is there a way to display the tags the in the order that they were added? That way it can just show the first tag added and my editors will know to just add the most important tag first.

    The site in question is: http://rare.talagsa.com/~dancart/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags