WordPress.org

Ready to get started?Download WordPress

Forums

Configuring custom field info to display by date (3 posts)

  1. Runtheball
    Member
    Posted 3 years ago #

    I'm trying to display a list of upcoming events, ordered by event date. I'm using a custom field on each post called 'expiration', with values similar to '02/07' and '03/13'. What I have now gets me the posts I want, but orders them by the last digits, like this:
    02/18
    03/13
    02/07

    here's the code I have at the moment:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    It seems the orderby=meta_value_num doesn't know that the values are dates. How can I fix this without making the custom field entry complex for the poster?

  2. Runtheball
    Member
    Posted 3 years ago #

    I guess the main question is how should a poster enter date info into a custom field, so that the posts can be sorted by that date?

    ...and just want to clean up that code.

    [Code moderated as per the Forum Rules. Please use the pastebin]

  3. esmi
    Forum Moderator
    Posted 3 years ago #

    Try using yy/dd/mm for your dates

Topic Closed

This topic has been closed to new replies.

About this Topic