WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
Query events by date - custom field (2 posts)

  1. micks800
    Member
    Posted 1 year ago #

    Hi,
    I have a custom field 'event-date' and I would like to only upcoming events which has event-date>today. I tried a lot but not able to make the query, can you please help?

    This is my current query -
    query_posts(array( 'post_type' => 'events','type' => 'party' ));
    if ( have_posts() ) : while ( have_posts() ) : the_post();

    The query_posts is not accepting custom fields. I tried WP_Query but it's not working either.

    Thanks,
    Mick

    http://wordpress.org/extend/plugins/types/

  2. AmirHelzer
    Member
    Plugin Author

    Posted 1 year ago #

    Until someone else jumps in and explains how to do this in PHP, using the correct WordPress API functions, would you like to see how Views does this?

    Have a look at Views date filters:
    http://wp-types.com/documentation/user-guides/date-filters/

    Using Views, you would create a new View for the 'events' custom post type. Then, filter it according to upcoming events.

    We're missing a feature to add date filtering according to values of custom fields of the current post. We'll try to include that in the next Views release. Now, you can filter by fixed dates, or relative to the current date.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.