Display filtered results into custom page

I am trying to use the “Search and Filter” plugin to give a wp_query filters, but I don’t want it to go to the search.php file. I want the results to be pulled up on the current page. I have searched for hours through tons of posts but nothing is pulling up, they all tell you how to modify your search.php file. Below is my current code. Any help is greatly appreciate.

<?php
$paged_var = get_query_var(‘paged’);
$args = array(
‘post_type’ => array(‘web_post’, ‘rely_post’, ‘how_post’, ‘info_post’, ‘case_study’, ‘podcast_episode’, ‘post’),
‘posts_per_page’ => 16,
‘paged’ => $paged_var ? $paged_var : 1
);
$the_query = new WP_Query( $args );
$count = 1; ?>
<?php echo do_shortcode(‘[searchandfilter headings=”Post Type, Tag” fields=”post_types,post_tag” post_types=”web_post,rely_post,how_post,info_post,case_study,podcast_episode,post”]’); ?>
<?php while($the_query->have_posts()):
$the_query->the_post(); ?>

<div class=”col-xs-12 col-md-3″>
<?php if (‘case_study’ == get_post_type()): ?>
<a href=”<?php the_permalink(); ?>”>
<img src=”<?php the_field(‘image’); ?>”>
</a>
<?php elseif (‘post’ == get_post_type()): ?>
<a href=”<?php the_permalink(); ?>”>
<?php the_post_thumbnail( ‘single-post-thumbnail’ ); ?>
</a>
<?php elseif (‘podcast_episode’ == get_post_type()): ?>
<a href=”<?php the_permalink(); ?>”>
<img src=”#”>
</a>
<?php else: ?>
<a href=”<?php the_field(‘lp_url’); ?>”>
<img src=”<?php the_field(‘cover_image’); ?>”>
</a>
<?php endif ?>

</div>
<?php if (($count % 4) == 0): ?>
<div class=”clearfix”></div>
<?php endif; ?>
<?php ++$count; ?>
<?php endwhile; ?>

<?php
$max_pages = $the_query->max_num_pages;
my_pagination($max_pages, 3); ?>
<?php wp_reset_query(); ?>

Read more here:: Display filtered results into custom page

Leave a Reply

Your email address will not be published. Required fields are marked *