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.
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.
The modified query args you suggested worked. Thanks for your help!
Ok, I figured out a way to make it work, but I’m still running into one more issue.
I reset the search form to use display results as a post type archive.
I then created a separate page template that just displays upcoming productions, and am using the archives-productions.php template to display past productions, instead of the other way around.
The filter UI is showing now and the filter works. However, I only want to display past productions, and then filter through those using the plugin.
I tried using the edit query arguments filter, but I can’t seem to get it to work.
Here’s what I added to my functions.php file:
//Modify query args for filter UI on Productions archive template
function filter_function_name( $query_args, $sfid ) {
//if search form ID = 6128, the do something with this query
if($sfid==6128)
{
//Today's date
$today = date('Y-m-d H:i:s');
$args = array(
'meta_query' => array(
array(
'key' => 'event_date',
'value' => $today,
'compare' => '<=',
),
)
);
}
return $query_args;
}
add_filter( 'sf_edit_query_args', 'filter_function_name', 20, 2 );
I tried to add the code to the existing query args, and it just returned. There was no UI for filtering the posts by year.
Yes, I have two page templates that display the CPT Productions. The main CPT archive, file called archive-productions.php only displays future productions.
I have another page template called page-past-productions.php that has a custom query that displays only past productions. This is the page where I want to display the filter UI.
I fixed that, but now just the custom query results appear as they did before, with no search or filter UI appearing.
I also added the shortcode for the results, same thing.
<?php do_shortcode('[searchandfilter id="6128"]') ?>
<?php do_shortcode('[searchandfilter id="6128" show="results"]') ?>
© 2024 Search & Filter Support. All Rights Reserved.
This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
We also use cookies to store items in your cart as well as allowing your to login on the site.
You can adjust all of your cookie settings by navigating the tabs on the left hand side.
By continuing to use this site, you also agree to our Privacy Policy.
Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.
*Other cookies used for logging in and cart functions will only be used when you use those features and cannot be disabled.
If you disable these cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.
This website uses Google Analytics to collect anonymous information such as the number of visitors to the site, and the most popular pages.
Keeping this cookie enabled helps us to improve our website.
Please enable Strictly Necessary Cookies first so that we can save your preferences!
More information about our Cookie Policy