Forums Forums Search & Filter Pro By default active and show one of the taxonomy.

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Anonymous
    #267502

    https://prnt.sc/vodelo Hi, by default I want to active Projections taxonomy when a user comes to this page. Is it possible then how?

    here is my code:

    <?php
    /* 
       Template Name: analysis
    */
    get_header();
    
    	$ourCurrentPage = get_query_var('paged');
        $args = array(  
       'post_type' => 'analysis',
       'post_status' => 'publish',
       'posts_per_page' => 10,
       'taxonomy' => 'projections',
       'paged' => $ourCurrentPage
        );
        $args['search_filter_id'] = 1605;
        $the_query = new WP_Query( $args );?>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/venobox/1.9.1/venobox.min.css" integrity="sha512-e+0yqAgUQFoRrJ4pZigQXpOE0S7J9IGwmgH801h4H5ODqOCG8/GRfXHQ+9ab754NL79O7wDwdjwY3CcU8sEANg==" crossorigin="anonymous" />
        <style>
            .f1p{display:flex;flex-wrap:wrap;max-width:900px;margin:auto;}.grant-parent{width:30%;margin:1%;padding:15px;background:#fff;border:1px solid #e5e5e5;border-radius:4px;}.heding.ccount{font-size:15px;margin-bottom:0px;}.pagination{width:100%;}
        </style>
                <div class="f1b-main" style="padding-top:30px;">
                    <?php echo do_shortcode('[searchandfilter id="1605"]'); ?>
                    <div class="f1p">
                        <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                        <?php $image = get_field( 'image' );?>
                        <div class="fl grant-parent">
                            <P class="heding ccount"><?php echo get_field( "date" );?></P>
                            <?php 
                                foreach((get_the_terms( $post->ID, 'analysis' )) as $category){
                                    echo "<p><a class='venobox' data-gall='$category->name' href='$image' data-title='the_title()'><img src='$image' /></a></p>";
                                }
                            ?>
                            <p class="heding ccount" title="<?php the_title(); ?>"><b><?php the_title(); ?></b></p>
                        </div>
    
                        <?php endwhile; ?>
    
                        <div class="pagination">
                            <h2><?php echo paginate_links(array(
                        'total' => $the_query->max_num_pages
                        ));
                        ?></h2>
                        </div>
    
                        <?php else : ?>
                        <div class="not-found">
                            <p><?php  _e( 'Sorry, no products matched your criteria.'); ?></p>
                        </div>
                        <?php endif; ?>
    
                        <?php wp_reset_postdata(); ?>
    
                    </div>
                </div>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/venobox/1.9.1/venobox.min.js" integrity="sha512-6mm1Gra+9mSztlk6Q45F1soEHmkduyd2ponCIWNo5pr0lgcr8d79GQjQ3Nw0uRR3/+y/OZGklAi38yE1QSNpCw==" crossorigin="anonymous"></script>
     <script>
     jQuery('input[value="projections"]').trigger( "click" );
     jQuery('.venobox').venobox(); 
        (function($) {
            "use strict";
            jQuery(document).on("sf:ajaxfinish", ".searchandfilter", function() {
                jQuery('.venobox').venobox();
            });
        }(jQuery));
    </script>
    
    <?php do_action( 'kadence_single' );
    get_footer();
    Trevor
    #267506

    Setting a default value is not possible with the current version of the plugin, but is something we intend to add in V3, due in a few months.

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