Forums › Forums › Search & Filter Pro › Issues getting filtering to appear via custom display option on CPT archive
Tagged: cpt archive, custom post type
- This topic has 1 reply, 2 voices, and was last updated 5 years, 6 months ago by
Trevor.
Viewing 2 posts - 1 through 2 (of 2 total)
-
Anonymous(Private) September 21, 2020 at 10:07 pm #260238
Hello. I have a custom post type archive template, where I’d like to display my search and filter form. I looked through the Docs, but must still be doing something incorrectly because I cannot get the filters to appear at all.
Here is the full code for my custom post type archive page:
<?php /** * Stream S2 Videos Archive * * @link https://developer.wordpress.org/themes/basics/template-hierarchy/ * * @package S2Breakthrough */ get_header(); ?> <main id="primary" class="site-main container"> <header class="page-header my-6"> <h1>Stream S2 Videos</h1> </header><!-- .page-header --> <?php echo do_shortcode('[searchandfilter id="1335" action="filter_next_query"]'); ?> <div class="videos-container mb-4 mt-10 flex flex-wrap justify-between"> <?php $args = array( 'post_type' => 'videos', 'posts_per_page' => 12, 'orderby' => 'date', 'order' => 'DESC', ); $args['search_filter_id'] = 1335; $loop = new WP_Query( $args ); if ( $loop->have_posts() ): while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="videos-item mb-20"> <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail(''); ?> </a> <div class="product-item-info flex justify-between mt-8"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="video-post-title font-serif text-darkblue tracking-1 text-28 leading-20 mt-2"><?php the_title(); ?></a> </div> </div> <?php endwhile; ?> <?php wp_reset_postdata(); ?> <?php else: ?> <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p> <?php endif; ?> </div><!--/.product-container--> </main><!-- #main --> <?php get_footer();Trevor(Private) September 22, 2020 at 7:53 am #260255This code:
<?php echo do_shortcode('[searchandfilter id="1335" action="filter_next_query"]'); ?>Only links a form to the results. It will not actually output the form.
This would do both (output form, then link to the results):
<?php echo do_shortcode('[searchandfilter id="1335"]'); echo do_shortcode('[searchandfilter id="1335" action="filter_next_query"]'); ?> -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)