Support Forums

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.

Forums Forums Search & Filter Pro Issues getting filtering to appear via custom display option on CPT archive

Viewing 2 posts - 1 through 2 (of 2 total)
  • Debbie Labedz
    #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 Moderator
    #260255

    This 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"]'); ?>
Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.