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.
-
Search Results
-
I’m having problems filtering sf_edit_query_args with the post__in query arg. Here’s a quick prototype that I have:
add_filter( 'sf_edit_query_args', function( $query_args, $sfid ) { if ( 20205 === $sfid ) { $query_args['post__in'] = array( 20696, 20694, 20612 ); } return $query_args; }, 20, 2 );
I double-checked that 20205 is the id of the search&filter form and that 20696, 20694, 20612 are actual custom post type ids. The form works as it should with the usual search&filter search field, custom post type filters, tag dropdowns, etc. But I’m not able to filter it programmatically with the provided post ids (however, it works correctly with a provided custom post type –
$query_args['post_type'] = 'custom';
). It simply returns no results. Is the post__in query arg not supported?Thanks!
Take a look at this page. http://powerschoolnew.staging.wpengine.com/resources/?post_types=whitepaper
I have 7 sticky posts in this post type. You can find them in the HTML with class=”resource-block featured”. When I first load the URL above, only 3 of the sticky posts appear in the first set of results (I wrap them in a carousel using jQuery). As I scroll, the other sticky posts appear(they will be 50% wide. I then move them to the top with jQuery.
Why aren’t my sticky posts ALL appearing first before all non-sticky posts? I tried deliberately setting ignore_sticky_posts to false using sf_edit_query_args but this made no difference.
Thanks for any help you can offer.
I’m using the code bellow to hide posts that are older than the current date. It’s working on the default results but it’s not working on the filter(dropdown).
Is there a way to exclude old posts from showing on the filter(Search Form UI) too?
Thanks
add_filter( ‘sf_edit_query_args’, ‘kp_exclude_old_post’, 100, 2 );
function kp_exclude_old_post( $query ) {$time_ago = date(‘Y-m-d’, strtotime(‘-1 day’));
$query[‘meta_query’] = array(
array(
‘key’ => ‘acfDia’,
‘value’ => $time_ago,
‘compare’ => ‘>=’,
‘type’ => ‘DATE’
)
);return $query;
}