Forums Forums Search & Filter Pro Custom Taxonomy Checkboxes not changing after first selection

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #258588

    Hi,

    I have a site using Genesis Recipe Pro theme. I have a custom loop, that loops through a custom post type. This post type also has a custom taxonomy.

    Everything works fine, until I try and filter by that taxonomy. The initial selection works. The query updates… But then, if I try and select any other checkbox, or unselect the chosen selection, it refreshes the page (correctly) but doesn’t change anything, including the checkbox still being selected. It is happening in 2 separate places:

    https://sunsetsewaneed.wpengine.com/equipment-resources
    https://sunsetsewaneed.wpengine.com/ingredients/

    Note that it works fine within the main WP archive loop using the WP categories taxonomy:

    https://sunsetsewaneed.wpengine.com/food-2/

    I have tried disabling all plugins. There is no caching. The form is added via a sidebar widget.

    Here is my code:

     $_terms = get_terms( array('product_category') );
    
        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
        $term_slug = $term->slug;
        $_posts = new WP_Query( array(
            'post_type'         => 'product_resources',
            'search_filter_id'  => 2406,
            'posts_per_page' => 12,
             'paged' => $paged
                
                ));
    
        if( $_posts->have_posts() ) :
    
            echo '<div class="flexbox">';
            while ( $_posts->have_posts() ) : $_posts->the_post();
            ?>
                <div class="flexbox-column">
                    <div class="fourty-width">
                        <a target="_blank" href="<?php the_field('affiliate_link');?>"><img src="<?php the_field('product_image');?>"></a>
                    </div>
                    <div class="sixty width">
                        <h2 class="entry-title"><a href="<?php the_field('affiliate_link');?>"><?php the_title(); ?></a></h2>
                        <p><?php the_field('product_description');?></p>
                        <a href="<?php the_field('affiliate_link');?>" class="affiliate-link" target="_blank">Get It</a>
                    </div>
                </div>
            <?php
            endwhile;
              $total_pages = $_posts->max_num_pages;
    
        if ($total_pages > 1){
    
            $current_page = $_posts->query_vars['paged'];
    
            echo '<div class="pagination">';
    
            if(strpos($_SERVER['REQUEST_URI'], '_sft_resource_category') !== false) {
    
                 echo paginate_links(array(
                    'base' => get_pagenum_link(1) . '%_%',
                    'format' => '&sf_paged=%#%',
                    'current'      => max( 1, $current_page ),
                    'total' => $total_pages,
                    'prev_text'    => __('« prev'),
                    'next_text'    => __('next »'),
                ));
               
            }
            else {
                 echo paginate_links(array(
                    'base' => get_pagenum_link(1) . '%_%',
                    'format' => '?sf_paged=%#%',
                    'current'      => max( 1, $current_page ),
                    'total' => $total_pages,
                    'prev_text'    => __('« prev'),
                    'next_text'    => __('next »'),
                ));
            }
    
            echo '</div>';
        }    
    
        wp_reset_postdata();
        echo '</div>';
        endif;
    Trevor
    #258589

    One issue that I see is that you are using the resource_category twice in the form, which is not allowed. You would need to make a second custom taxonomy and transfer the terms. This post discusses the issue and solution:

    https://support.searchandfilter.com/forums/topic/elementor-filter-not-working-showing-all-results/#post-221562

    Anonymous
    #258618

    Thanks for the reply.

    The only reason I have 2 is because I need the filters to display differently on mobile and desktop.

    On desktop, I need it as checkboxes. On mobile, I want it to be a dropdown. So I added 2 of the same filters, and hid the one that wasn’t needed on mobile.

    Is there no way to do that?

    Trevor
    #258621

    Not at the moment. In V3, due in a few months, it will be possible.

Viewing 4 posts - 1 through 4 (of 4 total)