Forums Forums Search & Filter Pro Default Display Results Using Shortcode and ACF dates

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #187717

    Hi,

    I’m using S&F Pro to search through a custom post type consisting of events. Events have a date set through an ACF date type field. Results are displayed using a shortcode, and style is applied using a custom results.php located in /search-filter/.

    Seaching and filtering work fine, but I can’t seem do to what I want with the default display of results (before using any kind of filter). I would like to display as default only future events, starting with the closest. Past events should remain accessible through search.

    I tried :
    – In Search & Filter > Posts : changing default order and/or secondary order but it doesn’t affect the way the results are displayed. Plus it doesn’t offer enough options anyway (hiding certain posts according to a certain criterion, here : past date).
    – Making a custom query in /search-filter/results.php : the results are displayed correctly but the filters don’t work anymore (displays the same results)

    How can I achieve what I’m looking for using your plugin ?

    Thanks,

    Pierre

    Trevor
    #187722

    Hi

    Please note that, as your license appears to have expired, you will first need to renew the license to receive support.

    If you have a license under a different account, you would need to log in to that account and add a private reply to this thread with that account so that I can tie the thread to that other account.

    Anonymous
    #187726
    This reply has been marked as private.
    Trevor
    #187728

    I would need that user to log in and post the question, sorry. However, you want a no search set of results, and then a search set of results? If so, this should help you:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1024)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      // your NO results code here
    } else {
      // your results code here
    }
Viewing 4 posts - 1 through 4 (of 4 total)