Forums › Forums › Search & Filter Pro › Default Display Results Using Shortcode and ACF dates
- This topic has 3 replies, 2 voices, and was last updated 6 years, 2 months ago by Trevor.
-
Anonymous(Private) September 7, 2018 at 4:39 pm #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(Private) September 7, 2018 at 5:13 pm #187722Hi
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.
Trevor(Private) September 7, 2018 at 5:49 pm #187728I 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 }
-
AuthorPosts