Grow your CSS skills. Land your dream job.

Displaying get_post_meta array in order?

  • # June 16, 2010 at 7:24 pm

    Hey guys. I’m using get_post_meta to get an array of all values from a certain set of custom fields. Currently, I guess by default, the get_post_meta array returns all the values starting with the most recent submitted value instead of the first value. For example, I enter 3 different values for the same custom field in this order:

    [key] Expansion
    [value] The Burning Crusade

    [key] Expansion
    [value] Wrath of the Lich King

    [key] Expansion
    [value] Cataclysm

    But the array returns them in reverse, so Cataclysm gets displayed first, followed by Wrath of the Lich King; which is opposite of what I need. I wouldn’t mind entering all the custom field info in reverse order (so it would reverse the reverse and come out correct) but I wouldn’t be able to add any more values that I didn’t add the first time. Like, if an expansion came out in 5 months and I wanted to go add that to the custom fields, I would have to re-enter all of them to be able to get them in the correct order.

    If there’s no way to display custom fields in the order they are entered, does anyone else have an idea of how I could achieve the same result?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".