Forums › Forums › Search & Filter Pro › Help me show search in taxonomy category custom post!
- This topic has 9 replies, 2 voices, and was last updated 4 years, 10 months ago by Trevor.
-
Anonymous(Private) December 14, 2019 at 1:50 pm #229129
Hello!
I have a a custom post type “case study” with a custom taxonomy “case-study-category” and a custom archive “taxonomy-case-study-category.php” as results page.
I add search form use shorcode in file taxonomy-case-study-category.php, but it doesn’t work when i search.
Please help me config it!
Thank you very much!Anonymous(Private) December 16, 2019 at 7:09 am #229146<h3>My code taxonmy category is: </h3>
<?php /** * Taxonomy Case Study Categories Template * * @package timomedia */ get_header(); ?> <div class="case-study-category case-study-inner"> <div class="container"> <?php if ( has_nav_menu( 'theme-menu' ) ) { ?> <div class="skt-menu"> <?php wp_nav_menu( array( 'theme_location' => 'theme-menu', 'container_class' => 'theme-menu' ) ); ?> </div> <?php } ?> <div class="skt-search"> <?php echo do_shortcode('[searchandfilter id="7448"]'); ?> </div> <div class="rt-case-study-box element-two row"> <?php global $wp_query, $meta ,$paged ,$post; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $term = $wp_query->get_queried_object(); $term_id = $term->term_id; $args = array ( 'post_type' => 'case-studies', 'posts_per_page' => '12', 'paged' => $paged, 'orderby' => 'date', 'order' => 'DESC', 'tax_query' => array( array( 'taxonomy' => 'case-study-category', 'field' => 'ID', 'terms' => $term_id ))); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ): while ($my_query->have_posts()) : $my_query->the_post(); $link = get_post_meta( get_the_ID(), 'skt_link_demo', true ); ?> <div class="rt-case-study-box-item col-lg-3 col-md-3 col-sm-4 col-xs-12"> <div class="holder"> <!--Post-thumbnail --> <div class="pic"> <img src="<?php echo plugins_url( 'radiantthemes-addons/assets/images/Blank-Image-100x70.png' ) ;?>" alt="No Image Found" data-no-retina="" width="400" height="264"> <a class="placeholder" href="<?php echo $link ;?>" style="background-image:url(<?php echo get_the_post_thumbnail_url( get_the_ID(), 'theme-size' ); ?>)" target="_blank"></a> </div> <!-- Post-thumbnail --> <!--Post-Button --> <div class="post-btn btn-demo"> <a href="<?php echo $link; ?>" class="post-button" target="_blank">Xem Thực Tế</a> </div> <div class="post-btn btn-dk"> <a href="#" class="post-button">Tư Vấn Ngay</a> </div> <!--post-Button --> <!--post-Data --> <div class="data matchHeight"> <h3 class="title"><a href="<?php echo $link; ?>" target="_blank"><?php the_title();?></a></h3> </div> <!--post-Data --> </div> </div> <?php endwhile;?> </div> <div class="col-md-12"> <?php if (function_exists("pagination")) { pagination($my_query->max_num_pages);} ?> </div> <?php else : ?> <?php get_template_part( 'content', 'none' ); ?> <?php endif; ?> <?php wp_reset_postdata(); ?> </div> </div> <?php get_footer(); ?>
Trevor(Private) December 19, 2019 at 3:16 pm #229489If I search for Digital, I get 10 results, this is correct:
https://www.screencast.com/t/aKIY94mf5Xs
What are you searching for (what terms) as there are only two category terms in that taxonomy?
Trevor(Private) December 23, 2019 at 4:58 pm #229715How to remove Page1? I do not know, it is part of the breadcrumbs your theme or an SEO plugin is making.
I do not understand what you mean on the search not being correct?
The text search is looking in that taxonomy, searching the taxonomy terms, and the word digital appears in the terms of 10 posts. I can see that in the earlier screenshot I sent you. Did you want that match to be exact phrase? So they have to search for
Digital Marketing
before it has results? -
AuthorPosts