WordPress.org

Ready to get started?Download WordPress

Forums

Need help using wp_query and meta_query (2 posts)

  1. Misamee
    Member
    Posted 3 years ago #

    I've a list of events with some custom fields.
    Two of these custom fields are "date_start" and "date_end".

    "date_start" is always filled, "date_end" could be empty.

    "date_start" and "date_end" values are in the "YYYY-MM-DD" format: this must help sorting and filtering.

    I need to get a list of all events that follow these two rules:

    (date_start >= today() AND date_end >= NULL) OR (date_end != NULL AND date_end >= today())

    I'm not sure yet if I must check for NULL (or ""?) to avoid error messages, but this is not the main issue.

    I tried to follow the codex page (http://codex.wordpress.org/Template_Tags/query_posts), but the instruction lost me around the "Multiple Custom Field Handling:" part :(

  2. Bill Erickson
    Member
    Posted 3 years ago #

    I've also tried but haven't been able to get a custom post type for events to work using just meta fields. Here's the approach I ended up taking: http://wptheming.com/2010/08/how-to-make-an-events-custom-post-type/

    Hope that helps.

Topic Closed

This topic has been closed to new replies.

About this Topic