Forums Forums Search & Filter Pro List Search Results Separated by Custom Taxonomy Term

Viewing 1 post (of 1 total)
  • Ross Moderator
    #253555

    Hi Jerry

    You are correct, so what you would probably want to do is add it to the query args in here:

    $patient_story_args = array(
    	'post_type' => 'patient_story',
    	'posts_per_page' => -1,
    	'tax_query' => array(
    		array(
    			'taxonomy' => 'patient_story_type',
    			'field' => 'slug',
    			'terms' => $patient_story_type->slug,
    		),
    		array(
    			'taxonomy' => 'patient_story_type',
    			'terms' => array('featured'),
    			'field' => 'slug',
    			'operator' => 'NOT IN',
    		),
    	),
    );

    So it would become:

    $patient_story_args = array(
    	'post_type' => 'patient_story',
    	'posts_per_page' => -1,
    	'tax_query' => array(
    		array(
    			'taxonomy' => 'patient_story_type',
    			'field' => 'slug',
    			'terms' => $patient_story_type->slug,
    		),
    		array(
    			'taxonomy' => 'patient_story_type',
    			'terms' => array('featured'),
    			'field' => 'slug',
    			'operator' => 'NOT IN',
    		),
    	),
    	'search_filter_id' => '123456',
    );

    Where 123456 is the ID of your search form.

    I might add though, if you have a lot of posts (over a few hundred), then this approach might start to become slow, because you are running multiple WP_Query – there might be a better (but probably much more complicated) way of doing it in that case.

    Best

Viewing 1 post (of 1 total)