WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Help! Sort by decimal custom field problem. (4 posts)

  1. CricketLaChica
    Member
    Posted 4 years ago #

    Hi everyone. I'm trying to make posts that have custom fields which contain numerical decimals, e.g., 234.34, 500.00, 3000.00. Now, I want to sort those posts by using a custom query_post().

    I did the meta_key=decimal&orderby=meta_value thing, but I'm having a problem because it's sorting alphabetically. So in doing that, it is treating 500.00 to be greater than 3000.00. Is there a way for me to fix this by modifying the query? Or maybe a custom function?

    Any help will be much appreciated.

    Regards,
    Cricket

    [moderated--bump removed. Please refrain from bumping as per Forum Rules]

  2. MichaelH
    Member
    Posted 4 years ago #

  3. CricketLaChica
    Member
    Posted 4 years ago #

    Sorry about that.

    This link solved my problem. Thanks a lot!

  4. MichaelH
    Member
    Posted 4 years ago #

    No problem. Thanks for the feedback. Marking as resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic