Forums Forums Search & Filter Pro Filter by ACF Date >= InputDate

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Anonymous
    #91185

    Hi,

    I have a list of events with ACF date based start and end dates, I wish to display all events after the selected date. Is there a hook / filter that would allow this logic to be applied ?

    Thanks, Dean

    Trevor
    #91188

    Hi

    Let us assume we had an event that runs 20170330 to 20170401

    If the user selects these dates, do you wish the event to ‘show’?

    A 20170329
    B 20170330
    C 20170331
    D 20170401
    E 20170402

    Can you indicate which of A-E you would want as ‘hits’?

    Anonymous
    #91285

    Hi Trevor,

    You raise a point I am still considering, but I need to manage client expectations in the mean time. Currently about 65% of the events are single day so an if acf-start-date >= entered-date will cover these.

    My other problem is more complicated in that a single event can cover various date ranges, it is implemented an an ACF Repeater with individual start and end dates for each valid range, an example if a produce market which is the first saturday of each month

    Start_End_Dates
    Row0->StartDate 20170304 EndDate 20170304
    Row1->StartDate 20170401 EndDate 20170401

    There are examples where individual row start and end dates are not on the same day so nothing can be assumed. Once this is sorted I am intending on providing the option to enter a date-range and all events that are on in that period.

    I was/am intending to contact D&C regarding a paid development to cater for these requirements and was finalising the criteria I require – if you support these types of requests that is (dont mean to sound presumptuous). I am happy for the result to be part of your product ongoing.

    In the mean time a comparatively straight forward >= start-date will buy me time.

    Thanks, Dean

    Trevor
    #91302

    Search & Filter does not support repeater fields. There will be PHP coded ways around this, but you need to understand this limitation.

    Considering what you have said above, I would have considered storing dates as individual dates (an array), but the only array fields allowed in ACF are textual ones. You might find it an idea to create a custom text field and place an ACF date value in this and request S&F to try a date match with this.

    Placing multi values in text fields is, I think, possible within ACF (you would have to check field types to see which allows multi values), and certainly supported by ACF in the search. It might work. Worth checking at this stage I think.

    As to the question of custom development work, it is not something that we are able to offer, I am sorry about that.

    Anonymous
    #91342

    Thanks Trevor, I understand S&F doesn’t support repeater fields. The use of ACF was driven by other requirements, but as you have pointed out we could introduce a standard custom field that stores the date array. In the mean time given current implementation I am referencing the first start date sub field directly in S&F and I can sucessfully complete filters so events on the user-selected dates is possible. Are you able to provide advice as to how this could be made >= rather than == ?

    Thanks, Dean

    Trevor
    #91367

    The only avenue I can think of is to see if you can use our Edit Query Arguments filter.

    I have never used meta key operators in this way, but this reference might help:

    http://www.billerickson.net/code/wp_query-arguments/

Viewing 6 posts - 1 through 6 (of 6 total)