Forums Forums Search Search Results for 'Sample Results Template'

Viewing 10 results - 21 through 30 (of 119 total)
  • Author
    Search Results
  • #240166

    In reply to: Numbered Pagination


    Anonymous
    Inactive

    Hi Trevor,

    I’m not sure where I define the ajax container. I copied the default results.php, pasted in an overriding template and made slight modifications to integrate Foundation CSS classes and pull in ACF field values.

    Here’s my results template 475.php

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      https://searchandfilter.com
     * @copyright 2018 Search & Filter
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    ?>
    
    <?php if ( $query->have_posts() ) : ?>
    
    <div class="grid-x grid-padding-x grid-margin-x resources-results-list">
    		
    	<?php 
    	
    	while ($query->have_posts()) : $query->the_post(); 
    	
    		$resource_link_type = get_field('resource_link_type');
    	
    		if( $resource_link_type == 'internal') :
    	
    			$link_dest = get_field('resource_internal');
    			$link_attr = '';
    	
    		elseif( $resource_link_type == 'external') :
    	
    			$link_dest = get_field('resource_external');
    			$link_attr = ' target="_blank"';
    	
    		elseif( $resource_link_type == 'download') :
    	
    			$link_dest = get_field('resource_download');
    			$link_attr = ' target="_blank" download';
    	
    		endif;
    	
    	?>
    		<div class="small-12 medium-6 large-4 cell">
    			<div class="resource-item">
    				<div class="resource-image text-center">
    					<?php the_post_thumbnail( 'full' ); ?>
    				</div>
    				<h3 class="resource-title"><?php the_title(); ?></h3>
    				<div class="resource-type"><?php the_field('resource_type'); ?></div>
    				<div class="resource-content">
    					<?php the_content(); ?>
    				</div>
    				<div class="resource-link">
    					<a href="<?php echo $link_dest; ?>" class="button"<?php echo $link_attr; ?>><?php the_field('resource_link_text'); ?></a>
    				</div>
    			</div>
    		</div>
    	<?php endwhile; ?>
    		
    </div>
    
    <div class="grid-x grid-padding-x pagination align-center">
        <?php /*
    	<div class="cell shrink nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    	<div class="cell shrink nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
        */ ?>
        
        <div class="cell shrink">
            <?php numbered_pagination(); ?>
        </div>
        
    </div>
    	
    			
    <?php 
    
    else : 
    
    ?>
    <div class="grid-x grid-padding-x">
    	<div class="small-12 cell">
    		<span>No Results Found</span>
    	</div>
    </div>
    <?php endif; ?>

    Trevor
    Participant

    You need to modify the code in the results.php to this:

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2015 Designs & Code
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    
    // If this file is called directly, abort.
    if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    }
    
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(70)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
    	
    	if ( $query->have_posts() )
    {
    	?>
    	
    	Found <?php echo $query->found_posts; ?> Results<br />
    	Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
    	
    	<div class="pagination">
    		
    		<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
    		<?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    	</div>
    	
    	<?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
    		<div>
    			<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    			
    			<p><br /><?php the_excerpt(); ?></p>
    			<?php 
    				if ( has_post_thumbnail() ) {
    					echo '<p>';
    					the_post_thumbnail("small");
    					echo '</p>';
    				}
    			?>
    			<p><?php the_category(); ?></p>
    			<p><?php the_tags(); ?></p>
    			<p><small><?php the_date(); ?></small></p>
    			
    		</div>
    		
    		<hr />
    		<?php
    	}
    	?>
    	Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
    	
    	<div class="pagination">
    		
    		<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
    		<?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    	</div>
    	<?php
    }
    else
    {
    	echo "No Results Found";
    }
    }
    ?>
    #235185

    Topic: infinite


    Anonymous
    Inactive

    Hello!

    I have repeated results, both in infinite scroll and in results with normal pagination type. I made the web a couple of years ago, and created a file for the results that is this:

    <?php
    /**
     * Search & Filter Pro
     *
     * Sample Results Template
     *
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2015 Designs & Code
     *
     * Note: these templates are not full page templates, rather
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think
     * of it as a template part
     *
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs
     * and using template tags -
     *
     * http://codex.wordpress.org/Template_Tags
     *
     */
    ?>
    
    <div class="sections_group">
      <div class="section ">
        <div class="section_wrapper clearfix">
          <div class="column one column_blog">
            <div class="blog_wrapper isotope_wrapper">
    <?php
    if ( $query->have_posts() )
    {
    	?>
    
     <div style="clear: both;">      
    	<h4 style="font-weight: bold; text-align: center;"><?php echo $query->found_posts; ?> cursos encontrados</h4>
    	<!--Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
    
    	<div class="pagination">
    
    		<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
    		<?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    	</div>-->
    </div>     
          <div class="  <div class="search-filter-results">
    ">
    
    	<?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    
    		?>
    		<div class="post-item isotope-item clearfix post type-post status-publish format-standard has-post-thumbnail hentry ">
      <div class="image_frame post-photo-wrapper scale-with-grid image" style="margin-bottom: 0 !important;">
        <div class="image_wrapper"><a href="<?php the_permalink(); ?>">
          <div class="mask"></div>
          <img width="960" height="502" src="<?php the_post_thumbnail("small"); ?>" class="scale-with-grid wp-post-image" alt="<?php the_title(); ?>"></a>
        </div>
      </div>
      <div class="post-desc-wrapper">
        <div class="post-desc">
          <div class="post-head">
            <!--<div class="post-meta clearfix">
              <div class="author-date"><span class="vcard author post-author"><span class="label">Publicado por </span><i class="icon-user"></i> <span class="fn"><?php the_author(); ?></span></span> </div>
    
            </div>-->
          </div>
          <div class="post-title">
            <h4 class="entry-title" itemprop="headline"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
            <?php the_excerpt(); ?>
          </div>
        </div>
      </div>
    </div>
    
    		<?php
    	}
    	?>
    
    <div style="clear: both;">
    
    	<div class="pagination">
    
    		<div style="text-align: center; font-weight: bold;"><span class="nav-previous"><?php previous_posts_link( '< ANTERIOR'); ?></span>&nbsp;&nbsp;&nbsp;<strong>Página <?php echo $query->query['paged']; ?> de <?php echo $query->max_num_pages; ?></strong>&nbsp;&nbsp;&nbsp;<span class="nav-next"><?php next_posts_link( 'SIGUIENTE >', $query->max_num_pages ); ?></span></div>
    		<?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    	</div>	
     </div>     
    
    	
    	<?php
    }
    else
    {
    	echo '<h4 style="font-weight: bold; text-align: center;">No hay más cursos para los criterios indicados.</h4>';
    	echo '<p style="font-weight: bold; text-align: center;"><a href="#" class="search-filter-reset" data-search-form-id="2889" data-sf-submit-form="always">Reiniciar filtros y mostrar todos los cursos.</a></p>';
    }
    ?>
              </div>
    
            </div>
          </div>
        </div>
      </div>
    </div>
    

    the web is http://www.sweetit.es/cursos
    with the view normal pagination type it looks like this
    https://www.sweetit.es/wp-content/uploads/2020/02/pagination-type-normal-page-01.jpeg
    https://www.sweetit.es/wp-content/uploads/2020/02/pagination-type-normal-page-02.jpeg

    with the view without scroll
    https://www.sweetit.es/wp-content/uploads/2020/02/pagination-type-infinite-scroll.jpeg

    If I put results per page 300 (total) does not repeat any results.

    I don’t know how to make the results look good, can you help me? If you need more information, you can write to me at sweetit@sweetit.es
    Thank you!

    #231823

    Anonymous
    Inactive

    Here is my code, just replace the <?php the_title (); ?> with your code (thumbnail, tags, categories..) and there you go.

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2015 Designs & Code
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(5555)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { ?>
    
    <?php
    	  // set up or arguments for our custom query
    	  $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
    	  $query_args = array(
    	    'post_type' => 'renting',
    	    'post__not_in' => array(4894, 4898, 4900, 4902, 4896),
    	    'tax_query' => array(
    	    'relation' => 'AND',
    	    array(
    	        'taxonomy' => 'mostrar-en-parrilla',
    	        'field'    => 'slug',
    	        'terms'    => 'si',
    	    ),
    	
    	),
    	    'posts_per_page' => -1,
    	    'paged' => $paged
    	  );
      // create a new instance of WP_Query
      $the_query = new WP_Query( $query_args );
    ?>
    
    	<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); // run the loop ?>
    		<?php the_title (); ?>
    
    <?php endwhile; ?>
    <?php endif; ?>
    <?php wp_reset_query(); ?>
      
    <?php } else {
    	
    	if ( $query->have_posts() )
    {
    	?>
    	
    	Found <?php echo $query->found_posts; ?> Results<br />
    	Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
    	
    	<div class="pagination">
    		
    		<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
    		<?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    	</div>
    	
    	<?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
    			
    			<?php the_title (); ?>
    
    		<?php
    	}
    	?>
    	Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
    	
    	<div class="pagination">
    		
    		<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
    		<?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    	</div>
    	<?php
    }
    else
    {
    	echo "No Results Found";
    }
    }
    ?>
    #228131

    Anonymous
    Inactive

    Hello –
    Do you know what I’m doing wrong here?
    I’m trying to display the two below ACF custom fields in my search results, but they don’t show up. What is the correct way to display them?

    Thanks!

    name: employer Type: Relationship
    name: salary Type: Text

    <?php the_field(’employer’); ?>
    <?php the_field(‘salary’); ?>

    —-

    <?php
    /**
     * Search & Filter Pro
     *
     * Sample Results Template
     *
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      https://searchandfilter.com
     * @copyright 2018 Search & Filter
     *
     * Note: these templates are not full page templates, rather
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode – think
     * of it as a template part
     *
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs
     * and using template tags –
     *
     * http://codex.wordpress.org/Template_Tags
     *
     */

    if ( $query->have_posts() )
    {
    ?>

    <h5 style=”#70757a”>Found <?php echo $query->found_posts; ?> Results<br /></h5>
    Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br />

    <div class=”pagination”>

    <div class=”nav-previous”><?php next_posts_link( ‘Older posts’, $query->max_num_pages ); ?></div>
    <div class=”nav-next”><?php previous_posts_link( ‘Newer posts’ ); ?></div>
    <?php
    /* example code for using the wp_pagenavi plugin */
    if (function_exists(‘wp_pagenavi’))
    {
    echo “<br />”;
    wp_pagenavi( array( ‘query’ => $query ) );
    }
    ?>
    </div>

    <?php
    while ($query->have_posts())
    {
    $query->the_post();

    ?>
    <div class=”job-search-results”>
    <h2>“><?php the_title(); ?></h2>
    <?php
    if ( has_post_thumbnail() ) {
    echo ‘<p>’;
    the_post_thumbnail(“small”);
    echo ‘</p>’;
    }
    ?>        
                            <div class=”search-results-employer”><h5>Employer Name: <?php the_field(’employer’); ?> </h5></div>
                            <div class=”search-results-employer”><h5>Salary: <?php the_field(‘salary’); ?> </h5></div>
                            <div class=”search-results-location”><h5><?php the_terms( 0, ‘city’); ?>, <?php the_terms( 0, ‘job_country’); ?></h5></div>
                            <div class=”search-results-skills”><h5>Skills: <?php the_terms( 0, ‘job_expertise’); ?> </h5></div>
    <div class=”search-results-date”><h5><small><?php the_date(); ?></small></h5></div>
    </div>

    <hr />
    <?php
    }
    ?>
    Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br />

    <div class=”pagination”>

    <div class=”nav-previous”><?php next_posts_link( ‘Older posts’, $query->max_num_pages ); ?></div>
    <div class=”nav-next”><?php previous_posts_link( ‘Newer posts’ ); ?></div>
    <?php
    /* example code for using the wp_pagenavi plugin */
    if (function_exists(‘wp_pagenavi’))
    {
    echo “<br />”;
    wp_pagenavi( array( ‘query’ => $query ) );
    }
    ?>
    </div>
    <?php
    }
    else
    {
    echo “No Results Found”;
    }
    ?>

    #227902

    Anonymous
    Inactive

    The results shortcode was outside that div.

    i place the code in the results page now like this:

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2015 Designs & Code
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    ?>
    <script type="text/javascript">
    	$(function(){
    		$(document).on("sf:ajaxfinish", ".searchandfilter", function(){
    		    console.log("ajax finish");
    		    // your code
    		});
    		$(document).on("sf:ajaxformfinish", ".searchandfilter", function(){
    			console.log("ajax complete");
    			// your code
    		});
    	});
    </script>
    <?php
    if ( $query->have_posts() )
    {
    	?>
    	<div class="woningzoeker-container">	
    		<?php
    		while ($query->have_posts())
    		{
    			$query->the_post();
    			
    			?>

    but still don’t get the console logs.
    if placed it outside the if and while loop as you told.

    #226945

    In reply to: Infinite Scroll


    Anonymous
    Inactive

    Hi Trevor,

    Apologies I’ve only just gotten around to trying this out, at the minute I get both messages coming up and I’m not entirely sure why, this is my results.php file.

    <?php
    /**
    * Search & Filter Pro
    *
    * Sample Results Template
    *
    * @package Search_Filter
    * @author Ross Morsali
    * @link https://searchandfilter.com
    * @copyright 2018 Search & Filter
    *
    * Note: these templates are not full page templates, rather
    * just an encaspulation of the your results loop which should
    * be inserted in to other pages by using a shortcode – think
    * of it as a template part
    *
    * This template is an absolute base example showing you what
    * you can do, for more customisation see the WordPress docs
    * and using template tags –
    *
    * http://codex.wordpress.org/Template_Tags
    *
    */

    if ( $query->have_posts() )
    {
    ?>
    <div class=”flex-grid” data-aos=”fade-up”>
    <?php
    while ($query->have_posts()){
    $query->the_post();
    ?>
    <div class=”RoleGridWrapper col”>
    <?php if( get_field(‘scrub_colour’) == ‘navy-blue’){ $postcolor = ‘#153F74’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘cornflower-blue’){ $postcolor = ‘#5184C4’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘mediterranean-blue’){ $postcolor = ‘#009EC7’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘ocean-blue’){ $postcolor = ‘#64BFD4’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘pale-sky-blue’){ $postcolor = ‘#97BADE’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘dark-green’){ $postcolor = ‘#00A296’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘mid-green’){ $postcolor = ‘#92CEBD’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘silver-grey’){ $postcolor = ‘#ABAAAB’; } ?>
    <div class=”roleContWrapper” style=”border-top: solid 10px <?php echo $postcolor; ?>”>
    <div class=”cardTAB”>
    <svg id=”scrubsIcon” data-name=”Layer 1″ xmlns=”http://www.w3.org/2000/svg&#8221; viewBox=”0 0 40 40″><title>Scrubs Icon</title><path style=”fill:<?php echo $postcolor; ?>;” d=”M39.6,7.22a40.13,40.13,0,0,0-13-4.12,1.11,1.11,0,0,0-1.39.72c-.43.91-.88,1.73-.92,1.8-1.72,3.28-3.54,6-4.18,6.19-.66-.16-2.48-2.63-4.25-5.63-.46-.76-.8-1.42-1.25-2.28a1.29,1.29,0,0,0-1.52-.77A37.94,37.94,0,0,0,.4,7.22a.78.78,0,0,0-.32,1L3.47,15a.79.79,0,0,0,.9.41l3.49-.87L6.78,36.11a.79.79,0,0,0,.79.83H32.43a.79.79,0,0,0,.79-.83L32.14,14.57l3.49.87a.79.79,0,0,0,.9-.41l3.39-6.78A.78.78,0,0,0,39.6,7.22Z”/></svg>
    </div>
    “>
    <h3 class=”postHeader”><?php the_title(); ?></h3>
    <div class=”postCATS”>
    <?php
    $categories = get_the_category();
    $parentCatName = get_cat_name($categories[0]->parent);
    if ( ! empty( $categories ) ) {
    ?>
    <span class=”parentCAT”><?php echo esc_html( $parentCatName ); ?></span>
    <?php
    }
    ?>
    </div>
    <p class=”postIntro”><?php the_field(‘brief_role_description’); ?></p>
    <div class=”readmoreWrapper”>
    <p class=”postreadmore” href=”<?php the_permalink(); ?>”>Learn more</p>
    </div>

    </div>
    </div>
    <?php
    }
    }else{
    //figure out which type of “no results” message to show
    $message = “noresults”;
    if(isset($query->query[‘paged’])) {
    if($query->query[‘paged’]>1){
    $message = “endofresults”;
    }
    }
    if($message==”noresults”) {
    ?>
    <div class=’search-filter-results-list’ data-search-filter-action=’infinite-scroll-end’>
    <span>No Results Found</span>
    </div>
    <?php
    } else {
    ?>
    <div class=’search-filter-results-list’ data-search-filter-action=’infinite-scroll-end’>
    <span>End of Results</span>
    </div>
    <?php
    }
    }
    ?>

    Can’t seem to see why it’s not choosing one or the other, the only way at the moment I can get it to find no results is to search for something that I know isn’t available.

    Thank you
    Scott

    #226404

    In reply to: Infinite Scroll


    Trevor
    Participant

    Are you using our shortcode display results method?

    If so, this is a modified exemplar results.php file to account for this behavior:

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2015 Designs & Code
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    
    if ( $query->have_posts() ) {
     ?>
     
     Found <?php echo $query->found_posts; ?> Results<br />
     <div class='search-filter-results-list'>
     <?php
      while ($query->have_posts())
      {
       $query->the_post();
       
       ?>
       <div class='search-filter-result-item'>
        <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
        
        <p><br /><?php the_excerpt(); ?></p>
        <?php 
         if ( has_post_thumbnail() ) {
          echo '<p>';
          the_post_thumbnail("small");
          echo '</p>';
         }
        ?>
        <p><?php the_category(); ?></p>
        <p><?php the_tags(); ?></p>
        <p><small><?php the_date(); ?></small></p>
        
        <hr />
       </div>
       
       <?php
      }
     ?>
     </div>
    <?php
    } else {
     
     //figure out which type of "no results" message to show
     $message = "noresults"; 
     if(isset($query->query['paged'])) {  
      if($query->query['paged']>1){
       $message = "endofresults";
      }
     }
     
        if($message=="noresults") {
        ?>
     <div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
      <span>No Results Found</span>
     </div>
     <?php
        } else {
     ?>
     <div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
      <span>End of Results</span>
     </div>
     <?php
     }
    }
    ?>
    #220320

    Anonymous
    Inactive

    Thanks! That worked well.
    Just out of curiosity, my code works but I have such a rudimentary understanding of PHP I only want the fields “image” and “business_description” to display if it exists. This is what I got. How can I add that in or is there some post I can look at to figure it out. `<?php
    /**
    * Search & Filter Pro
    *
    * Sample Results Template
    *
    * @package Search_Filter
    * @author Ross Morsali
    * @link https://searchandfilter.com
    * @copyright 2018 Search & Filter
    *
    * Note: these templates are not full page templates, rather
    * just an encaspulation of the your results loop which should
    * be inserted in to other pages by using a shortcode – think
    * of it as a template part
    *
    * This template is an absolute base example showing you what
    * you can do, for more customisation see the WordPress docs
    * and using template tags –
    *
    * http://codex.wordpress.org/Template_Tags
    *
    */

    if ( $query->have_posts() )
    {
    ?>
    <?php
    $header_link = the_field(‘business_website_address_url’);
    ?>

    <?php
    while ($query->have_posts())
    {
    $query->the_post();

    ?>

    <div>
    <h2><a href=”<?php the_field(‘business_website_address_url’); ?>”><?php the_title(); ?></a></h2>
    <div class=”desc”><img src=”<?php the_field(‘image’); ?>”><p><?php the_field(‘business_description’) ?></p></div>
    <p class=”details”> Website: <a href=”<?php the_field(‘business_website_address_url’); ?>” target=”_blank”><?php the_field(‘business_website_address_url’) ?></a></p>
    <p class=”details”> Phone: <a href=”tel:<?php the_field(‘phone’); ?>”><?php the_field(‘phone’) ?></a></p>
    <p class=”details”> Booth: <?php the_field(‘booth_number’) ?></p>

    </div>

    <hr />
    <?php
    }
    ?>
    Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br />

    <div class=”pagination”>

    <div class=”nav-previous”><?php next_posts_link( ‘More Exhibitors’, $query->max_num_pages ); ?></div>
    <div class=”nav-next”><?php previous_posts_link( ‘Previous Exhibitors’ ); ?></div>
    <?php
    /* example code for using the wp_pagenavi plugin */
    if (function_exists(‘wp_pagenavi’))
    {
    echo “<br />”;
    wp_pagenavi( array( ‘query’ => $query ) );
    }
    ?>
    </div>
    <?php
    }
    else
    {
    echo “No Results Found”;
    }
    ?>`

    #220223

    Anonymous
    Inactive

    Hi Trevor
    I’d like my results to all display the same sized images, and/or when they float left, to snug up to the result box above it instead of leaving awkward spaces. I tried using a plugin to create a new image size ‘homepage-thumb’ and regenerated the images. Then I put that into the template file which I have pasted below.
    Thanks in advance for your help! Let me know if there is anything else you need.

    Here is my results page: https://nbgqa.com/project-gallery/

    Template code (wp-content / themes / headway / search-filter / 1922.php

    <?php
    /**
    * Search & Filter Pro
    *
    * Sample Results Template
    *
    * @package Search_Filter
    * @author Ross Morsali
    * @link http://www.designsandcode.com/
    * @copyright 2015 Designs & Code
    *
    * Note: these templates are not full page templates, rather
    * just an encaspulation of the your results loop which should
    * be inserted in to other pages by using a shortcode – think
    * of it as a template part
    *
    * This template is an absolute base example showing you what
    * you can do, for more customisation see the WordPress docs
    * and using template tags –
    *
    * http://codex.wordpress.org/Template_Tags
    *
    */

    if ( $query->have_posts() )
    {
    ?>

    <div class=”pagination”>

    <div class=”nav-previous”><?php next_posts_link( ‘Older posts’, $query->max_num_pages ); ?></div>
    <div class=”nav-next”><?php previous_posts_link( ‘Newer posts’ ); ?></div>
    <?php
    /* example code for using the wp_pagenavi plugin */
    if (function_exists(‘wp_pagenavi’))
    {
    echo “<br />”;
    wp_pagenavi( array( ‘query’ => $query ) );
    }
    ?>
    </div>

    <div class=”results-container”>
    <?php
    while ($query->have_posts())
    {
    $query->the_post();

    ?>
    <div class=”result-box”>
    “>
    <?php
    if ( has_post_thumbnail() ) {
    echo ‘<p>’;
    the_post_thumbnail(“homepage-thumb”);
    echo ‘</p>’;
    }
    ?>

    <h2>“><?php the_title(); ?></h2>
    <h3 class=”post-excerpt”><?php the_excerpt(); ?></h3>

    </div>

    <?php
    }
    ?>
    </div>

    <div class=”pagination”>

    <div class=”nav-previous”><?php next_posts_link( ‘Older posts’, $query->max_num_pages ); ?></div>
    <div class=”nav-next”><?php previous_posts_link( ‘Newer posts’ ); ?></div>
    <?php
    /* example code for using the wp_pagenavi plugin */
    if (function_exists(‘wp_pagenavi’))
    {
    echo “<br />”;
    wp_pagenavi( array( ‘query’ => $query ) );
    }
    ?>
    </div>
    <?php
    }
    else
    {
    echo “No Results Found”;
    }
    ?>

Viewing 10 results - 21 through 30 (of 119 total)