Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search Search Results for 'Sample Results Template'

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

    Trevor
    Moderator

    I checked back on my notes and before, with Thrive, I ‘cheated’ by creating a custom results.php template that mimicked the Thrive page. So, make the page and content as you like ignoring our plugin entirely, then inspect the HTML of the content area and edit the results.php we provide as an exemplar following this guide, so that it matches the structure and classes etc.):

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results

    So, here is one I made before:

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Thrive Results Template
     * 
     */
    
    if ( $query->have_posts() )
    {
    	?>
    	
    	Found <?php echo $query->found_posts; ?> Cars<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>
    	<div class="thrv_wrapper thrv_post_grid" data-unit="px">
    	  <div class="tve_post_grid_wrapper tve_clearfix tve_post_grid_grid">
    
            <div style="display: flex;" class="tve_pg_row tve_clearfix">
    
    	<?php
        $thrive_counter = 0;
        $thrive_row_counter = 0;
    	while ($query->have_posts())
    	{
          if ( $thrive_counter == 0 ) && ( $thrive_row_counter > 0 ) {
          ?>
    	    </div>
            <div style="display: flex;" class="tve_pg_row tve_clearfix">
          <?php
          }
          $query->the_post();
    		
          ?>
    			<div class="tve_post tve_post_width_5 " style="align-items: stretch;">
                  <div class="tve_pg_container">
    			
    			
    			<?php 
                  if ( has_post_thumbnail() ) {
                    $thrive_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'single-post-thumbnail' );
    			?>
                      <a href="<?php the_permalink(); ?>">
                        <div class="tve_post_grid_image_wrapper" style="background-image: url('<?php echo $thrive_image[0]; ?>')">
                          <div class="tve_pg_img_overlay">
                            <span class="thrv-icon thrv-icon-forward"></span>
                          </div>
                        </div>
                      </a>
    			<?php
                  }
    			?>
    
    		        <span class="tve-post-grid-title " style="font-size: 18px;line-height: 20px;font-family:'Arial', 'Helvetica', 'sans-serif';">
                      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                    </span>
    
                    <div class="tve_pg_more" data-tve-custom-colour="62938813">
                      <a href="<?php the_permalink(); ?>">View Now</a>
                      <span class="thrv-icon thrv-icon-uniE602"></span>
                    </div>
    			
                  </div>
                </div>
    		
    		<?php
          $thrive_counter++;
          if ( $thrive_counter > 4 ) {
            $thrive_counter = 0;
            $thrive_row_counter++;
          }
    	}
    	?>
    	    </div>
          </div>
        </div>
    	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";
    }
    ?>
    #244740

    Jacklyn Bright
    Participant
    This reply has been marked as private.
    #243477

    In reply to: styling search results


    Ali Goodarzi
    Participant
    This reply has been marked as private.
    #243260

    In reply to: styling search results


    Trevor
    Moderator

    Comparing the two forms is not easy, as you have dropdown selects in one and checkboxes in the other?

    I DO see an issue with the infinite scroll that needs fixing, where it shows No Results at the bottom. This is a modified version of the standard infinite scroll results.php file to stop it from happening:

    <?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
     }
    }
    ?>

    As for the styling, might you be able to show me an annotated (naming colors, font family, weight, size) screenshot of the frontend form and what needs changing? You would need to upload the screenshot image to a file sharing site (like the WordPress Cloudup site) and share the link for it with me?

    #242133

    Trevor
    Moderator

    To modify the output of the results.php template file (I have done this for myself on projects, and even some using Avada), I have examined the output HTML on a sample page and reverse engineered that into a combination of HTML and PHP for a custom template. For Avada, it used to typically take 4-8 hours to do though.

    An alternative solution (and what I now do if I am having to use Avada) is to use a plugin that works in a similar way to our shortcode method:

    https://searchandfilter.com/documentation/3rd-party/post-grid/

    In the Post Grid plugin, you determine the number of columns by using the post width setting.

    #241830

    Trevor
    Moderator
    This reply has been marked as private.
    #240166

    In reply to: Numbered Pagination


    kiwicreative
    Participant

    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
    Moderator

    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";
    }
    }
    ?>
    #236425

    epok
    Participant
    This reply has been marked as private.
    #236040

    J M
    Participant
    This reply has been marked as private.
Viewing 10 results - 21 through 30 (of 159 total)