• Hi, first want to say this plugin is super! awesome job

    now I’m on step where trying to customize my template to show results in best way for users.

    1 – is there a way to show some category scroll down list to search only in selected category as the option. to my template ?

    2 – other question is, plugin give us the option to show post thumbnail but the size ow it is 15-/150, and i want to show not a thumbnail, i wan full image resezed in css to 17/250 how to do it? i have resize image but have cutted sides cuz is fitted to 150/150 first

    <?php
    /*
    Template Name: Search Page
    */
    ?>
    <?php get_header(); ?>
    <div class="col-md-9">
    <?php
    /**
     * The template for displaying Search Results pages.
     *
     * @package WordPress
     * @subpackage Twenty_Eleven
     * @since Twenty Eleven 1.0
     */
    $s = bsearch_clean_terms( apply_filters( 'the_search_query', get_search_query() ) );
    get_header(); ?>
    
    	<section id="primary">
    		<div id="content searchpageform" role="main">
    			<?php $form = get_bsearch_form( $s );
    			echo $form;	?>
    			<header class="page-header">
    				<h1 class="page-title"><?php printf( __( 'Wyniki wyszukiwania dla: %s', 'twentyeleven' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
    			</header>
    			<div class="ptorrent-desc searchpage">
    			<?php echo get_bsearch_results( $s, $limit ); ?>
    			</div>
    		</div><!-- #content -->
    	</section><!-- #primary -->
    
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • Plugin Author Ajay

    (@ajay)

    The best option in this case would actually be to mix up the results of Better Search and then run a WP_Query request to it and then set up whatever template you want for WP_Query to kick in. You’ll need to be able to capture the category as well.

    Please see what I did with another plugin (that doesn’t have Better Search integrated yet) in terms of search templates

    https://github.com/WebberZone/knowledgebase/blob/master/public/templates/search-wz_knowledgebase.php

    For WP_Query, you’d use the argument of posts__in and pass this as : bsearch_clause_prepare()

    
    	$args = array(
    		'post__in' => bsearch_clause_prepare(),
    		'orderby' => 'post__in',
    		'posts_per_page' => 7,
    		'ignore_sticky_posts' => 1 
    	);
    	
    	$my_query = new WP_Query( $args );
    

    Another example as follows on my plugin Top 10 that uses an example of WP_Query: https://gist.github.com/ajaydsouza/c8defd4b46e53240e376

    In terms of Better Search, filtering and advanced search forms is what I plan to introduce in a paid addon.

Viewing 1 replies (of 1 total)
  • The topic ‘How to add category filter to my template’ is closed to new replies.