Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Query another WordPress table

Viewing 10 posts - 11 through 20 (of 39 total)
  • Trevor Moderator
    #49773

    I understand that. The thread is now assigned to him.

    Ross Moderator
    #49998

    Hey Francois

    What you are trying to do is technically not possible with S&F at the moment.

    I have made good steps towards allowing this kind of functionality but its not ready yet.

    The idea is that you will be able to create your own fields in the forms and wire them up any way you wish in terms of affecting the query..

    **Edit – I started writing a potential workaround below, but as I got through it and checking the plugin options I realise this is not possible either. I will be looking into adding a new “compare mode” which facilitates the exclude of dates – which does not yet exist but I can’t see it being too hard to add.

    Anyway.. leaving this info here as it will become relevant again once I add in the required functionality..

    However for now this is not yet possible so the way I would approach the above is to save the unavailable dates as post meta – and I would automate this…

    So my approach would be:

    1) hook into save_posts
    2) Whenever an event is saved (check the post type etc), also save those unavailable dates as post meta using update_post_meta – make sure the date is saved in YYYYMMDD format in the post meta (you might have to do some date formatting using the PHP date function)
    3) Then in S&F, you can add a post meta field, set it to date, choose the correct start/end meta keys and then change the “compare mode” to exclude (* this is the compare mode that needs adding to the plugin and is not yet available)

    Hope that explains things a bit, I will be looking at timelines to add this in and get back to you.

    Thanks

    François
    #50777

    Hello Ross,

    Thank you for your answer.

    I’ve managed to update the Wp posts results outputed by your plugin based on a specific hardcoded date.

    What I do is the following :
    – as soon as your plugin get the results based on the S&F form, I get the wp posts list,
    – then based on the hardcoded date I check for each of the shows outputed by your plugin if it’s available for that date or not,
    – then I only keep and display the shows which are available for that date.

    Would it be possible for you to explain me :
    – how to create a new datepicker field (hardcoded somewhere in your plugin I guess) to display it in a specific Search & filter form,
    – will that new field automatically appear in the url (get method) as the others fields ? like : date=20160711 .

    As soon as I’ll be able to add that field and get it from the url I’ll be done! Soo cool! Thank you 🙂

    Thank you for your help,
    François

    Trevor Moderator
    #50883

    Hi François

    I am wondering whether you could create a fake array of dates and get S&F to use this as a date field which would then use the datepicker?

    Some time ago another user figured how to do this (in their case doing a lookup on an ACF field), see here:

    https://support.searchandfilter.com/forums/topic/acf-labels-not-being-picked-up/

    But maybe the principle could work for you? A stab in the dark by me.

    François
    #50884

    Hi Trevor,

    I’m using ACF on our site so it sounds like a good idea.
    I’ve just checked and it seems that they provide datepicker as well.

    Then I can add that field with the form editor and update the query like explained before.

    That sounds good! I’ll try it soon and I’ll come back to you.

    Thank you for your help,
    François

    François
    #50885

    Hi Trevor,

    I’m just thinking.

    – I can create a new acf datepicker, then I can add it in the form and use its value from the url.
    – But then my question is the following one : how can I tell S&F not to query on that field ?

    Thank you,
    François

    Trevor Moderator
    #50886
    François
    #50888

    Ok, thank you. The idea is to tell S&F to ignore that field in its query.
    Then I’ll refine its results using the date passed in the url.

    Thank you,
    I’ll have a look at it.

    François

    François
    #50910

    Hi Trevor,

    I’ve quickly added the filter function in my functions.php file and the function is well fired.

    My concern is that the print_r($args) array is empty and that the url parameters are not displayed in the url anymore. Is it normal ?

    Shouldn’t it contain the args of the original query ? Then I could update them and return them ?
    How can I catch the args every time the user modify its request ?

    Thank you!

    Trevor Moderator
    #50913

    Doesn’t sound right that. Did you use that code in the theme functions.php?

Viewing 10 posts - 11 through 20 (of 39 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.