• Resolved guel

    (@guel)


    Hi, I’m using custom fields on a page. I use the following code to get the values I want.

    <?php if (get_post_custom_values('Testimonial')){
        $mykey_values = get_post_custom_values('Testimonial');
        foreach ( $mykey_values as $key => $value )
            echo  "<li>$value</li>";
        } ?>

    The values are not going in chronological order at all. It looks like it’s going by alphabetical or length order. I want to make this go in chronological order. For example, new ones on top and old ones go bottom as I add custom fields. I actually don’t mind which chronological way it goes because I can change it with array_reverse();.

    Any suggestion please?
    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • What sort of values are you storing in the custom fields?

    Thread Starter guel

    (@guel)

    Value: My Name
    some paragraph.

    Nothing special. I am still in testing, so I put random values and some would follow the order, but sometimes it will get inserted around the middle or out of order.

    Could you preface Your Name with a three digit number starting at 001? If each new custom field then incremented that number, you should be able to pull out a sorted array and remove the first 3 characters before display.

    Thread Starter guel

    (@guel)

    I found out what was going on. If you set the custom fields and update right way, sometimes it messes the order. If I go back to admin and hit Update, everything gets back to the correct order.

    Thanks esmi!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Rules for the order of custom fields’ is closed to new replies.