• Hi,
    I am currently running a query using data from some custom fields. The query looks like this:

    query_posts('meta_key=event%20name&orderby=meta_value&meta_key=start%20date&meta_compare=>=&meta_value='.date('Y/m/d', current_time('timestamp')).'&posts_per_page=-1&order=ASC&cat=1');

    I’m using to create an events style page. The only problem is that I have some events which last for a number of week. On these events I have custom fields for both ‘start date’ and ‘end date’. Events that last for one day just have ‘start date.’

    What’s happening at the moment is that once the ‘start date’ passes for any event it is disappearing from the page. This isn’t too great when the event may still be happening for another three weeks. Basically what I want is a query that brings all posts unless their ‘end date’ has passed (and if they don’t have an ‘end date’ it would be after their ‘start date’ has passed) but that also orders entries by ‘start date’ and not ‘end date.’

    Is this possible?

Viewing 1 replies (of 1 total)
  • Since you don’t have end dates for some events, there really isn’t a way to do this query. If there was an end date, you could query for only end dates in the future.

Viewing 1 replies (of 1 total)
  • The topic ‘Problems with Querying Custom Fields’ is closed to new replies.