WordPress.org

Ready to get started?Download WordPress

Forums

Ultimate WP Query Search Filter
Date Range filter (7 posts)

  1. ckw123
    Member
    Posted 7 months ago #

    Hello TC,
    Thanks for designing such great plugin for all WP users.
    I would like to seek for your advice. I added custom field (effective start date and effective end date of tickets). How can I set a filter search on date range? For example, user search tickets which are still effective, i.e. effective start date </= today </= effective end date.
    Sorry I am not good at coding. Please advise. Thanks in advance.

    http://wordpress.org/plugins/ultimate-wp-query-search-filter/

  2. TC.K
    Member
    Plugin Author

    Posted 7 months ago #

    It's a bit tricky to query date.
    The easiest way is store your date value in number format by using php strtotime() when saving your date,then you can directly using '>' or '<' for the filter field. But remember, the options of the field you got to manually change the value back to date format by using php date() function.

  3. ckw123
    Member
    Posted 6 months ago #

    Thanks very much, TC. I will try to figure out though I am a basic user.

  4. kkriss
    Member
    Posted 6 months ago #

    Hello. Your plugin seems to be perfect for me, but I need also to filter all custom post types between a startdate and an enddate (daterange). I read the solution you gave to ckw123 but I don't understand why using the ' or ' for filtering. The filter should be 'from' a date --> 'to' another date. Could you kindly explain me more? Thank you.

  5. TC.K
    Member
    Plugin Author

    Posted 6 months ago #

    The > or < can be used for From or Before.

    For from --> to, you can use Between instead.

  6. kkriss
    Member
    Posted 6 months ago #

    Cool, thanks! Where could I find a list of choices (from, before, or, between ... others)?

  7. TC.K
    Member
    Plugin Author

    Posted 5 months ago #

    It is on the meta field section where you choose the Compare select field

Reply

You must log in to post.

About this Plugin

About this Topic