Ready to get started?Download WordPress


Only use first tag? (6 posts)

  1. seg
    Posted 6 years ago #

    I am using the Simple Tags plugin and I am trying to figure out how to display only the first tag entered in the post. I tried this:
    st_the_tags('notagtext=&number=1'); }

    But if the pot has multiple tags then the tags will be randomly displayed. st_the_tags(} doesn't seem to have any 'order' parameter. I also looked at the st_tag_cloud() function with the notagtext, number, cloud_selection and cloud_sort paramters - unfortunately the selection and sort parameters only organize alphabetically, popularity or randomly.

    Is there a way to detect and only display the first tag?

  2. nudnik
    Posted 6 years ago #

    There is no data in the database that stores the order the tags were entered in.

  3. seg
    Posted 6 years ago #

    I don't doubt this, but when you go back to edit a post, how does the post maintain the correct order of tags in the text editor? Is there some sort of query that I could access the tag text that displays correctly in the text editor?

  4. seg
    Posted 6 years ago #

    Correction - the tags don't keep their original order in the text editor when going back to edit the post, they organize alphabetically. When I witnessed this I had originally inputed the tags alphabetically. Very frustrating that you can't maintain an order. I also explored subcategories to simulate identifying a blog by a specific topic, but I could find very little documentation and functions for subcategories.

    If I was to mark a post with both the a parent category to keep the parent categories template design and a subcategory to identify it with a specific topic (such as News, Music, etc.), is there a function to display the subcategory's title in the post on the category page and single (post) page? I tried using single_cat_title(), but it seems to pull the parent category title, not the subcategory.

  5. nudnik
    Posted 6 years ago #

    If you can organize the tags by importance, you can write a php script that will loop through the tag list and pull the one that's most "important". So if the most important tag is "news," any post marked "news" will have that displayed. Otherwise, it will display the next-most important.

  6. Os..
    Posted 5 years ago #

    Hi Seg,
    having similiar question: related posts based on one tag- ordered by categories: http://wordpress.org/support/topic/178137?replies=1

    Did you have any development on your side?

Topic Closed

This topic has been closed to new replies.

About this Topic