Forums Forums Search Search Results for 'results.php'

Viewing 10 results - 1,001 through 1,010 (of 1,224 total)
  • Author
    Search Results
  • #45680

    In reply to: Results not refreshing


    Trevor
    Participant

    I can do that quite easily. Do this for now:

    1. Create a folder in your theme folder called search-filter.
    2. Copy the file wp-content\plugins\search-filter\templates\results.php from the templates folder in to the newly created folder in your theme – wp-content\themes\your-theme-name\search-filter\results.php

    #45546

    Trevor
    Participant

    It depends on the Display Result method that you have chosen. If you are using the shortcode method, you need to have (should already have) placed a copy of the provided results.php file in a sub-folder (named search-filter) of your child theme folder. You can edit this file to do what you want.

    Any other method uses your theme’s own template files, and you will need to edit them, or ask the theme author for guidance.

    #45273

    Anonymous
    Inactive

    Hi Trevor, thanks for getting back to me so quickly.

    To answer your questions:

    #1 – I’m not sure when it happened, whether it was an update of S&F or an update of my theme – I have only noticed it recently.
    #2 – Yes it uses results.php.
    #3 – Yes I edited results.php and had it outputting the results as described above.
    #4 – Yes I did.
    #5 – I have backups going back to 14th April, but looking at the file from then and today’s file, I can’t see any difference between them (having had a quick look)?

    Thanks

    Andy

    #45272

    Trevor
    Participant

    Hi Andy

    I suspect I know what has happened, and you may have already guessed, but, a few questions:

    #1 This happened at an update of S&F?
    #2 Your search setup uses the results.php template?
    #3 Had you edited/modified that results.php file to output the results as you wanted?
    #4 Did you make a folder called search-filter in your theme/child theme folder and put the modified version of results.php in there?
    #5 Do you have a backup of this file from before the update?

    #45212

    Anonymous
    Inactive

    No problem – speedy recovery.

    I think the problem lies with the code I have customized here for results.php in SFpro. It seems that maybe my conditional for the second part doesn’t take into consideration the arguments of the query. I end up with all the posts in my db generating equivalent modals. :

    <?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
     *
     */
    
    // $term_list = wp_get_post_terms($post->ID, 'product_features', array("fields" => "all"));
    // foreach($term_list as $term_single) {
    // echo $term_single->slug; //do something here
    // }
    
    if ( $query->have_posts() )
    {
    	?>
    
    	<div class="">
    
    	<?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    
    		?>
    
    			<a class="col-md-6 col-lg-4 col-sm-6">
    				<article class="module-container eModal-post-<?php the_ID();?>" href="<?php the_permalink();?>">
    
    				    <h3><?php the_title();?></h3>
    
    				</article>
    			</a>
    
    			<?php
    
    			if( get_field( "demo_module" )) {
    
    			echo do_shortcode( "[modal id='post-". get_the_ID() ."' size='large' title='". get_the_title() ."']".
    
    				 "<div class='col-md-8'>"  . get_the_content() .  "<div class='demo-module'>" . "<a class='cta-button-v4' href='" . get_field( "demo_module" ) . "' target='_blank'>Download Demo Module</a>". "</div>" .  "</div>" . "<div class='col-md-4'>" . do_shortcode("[module_author]") . "</div> <div class='col-md-12'><div class='cta-module'>" . do_shortcode("[cta_module_shortcode]") . "</div></div>" .
    
    				 do_shortcode("[wpdm_package id='". get_the_ID() . "']").  "[/modal]" );
    
    			 } else {
    
    				 echo do_shortcode( "[modal id='post-". get_the_ID() ."' size='large' title='". get_the_title() ."']".
    
    	 				 "<div class='col-md-8'>"  . get_the_content() .   "</div>" . "<div class='col-md-4'>" . do_shortcode("[module_author]") . "</div> <div class='col-md-12'><div class='cta-module'>" . do_shortcode("[cta_module_shortcode]") . "</div></div>" .
    
    	 				 do_shortcode("[wpdm_package id='". get_the_ID() . "']").  "[/modal]" );
    
    			 }
    
    				 ?>
    
    		<?php
    	}
    	?>
    
    	</div>
    
    	<?php
    }
    else
    {
    	echo "No Such Modules";
    }
    ?>
    
    #44951

    Trevor
    Participant

    So, it is relatively simple if you are using the Shortcode Display Results method. See the documentation:

    http://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/

    See how it is using a template called results.php?

    This is that file:

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

    And here is it modified:

    <?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() ) {
    	global $searchandfilter;
    	$sf_current_query = $searchandfilter->get(1526)->current_query();
    	if ($sf_current_query->is_filtered()) {
    		?>
    
    		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";
    }
    ?>

    replace 1526 with the id of your search form.

    #44633

    Anonymous
    Inactive

    I had to put back the original code for the client. When I add the modified results.php code everything disappears. We only want the results to go away prior to the search. Let me know if I need to put the modified code back in for you to troubleshoot it.

    #44623

    Trevor
    Participant

    Thanks. That template file is very specific to displaying searches within the theme and will not allow our search system to display (at least, not easily, but we may have to try that).

    You have the search placed at the top of the right sidebar, yes? Is it possible to do this using a shortcode in this theme, and for the results page to have the results shortcode in it?

    The results will not look so good, but that we can fix with a custom results.php file.

    #44355

    In reply to: Configure not showing


    Anonymous
    Inactive

    Says Error: The custom template file results.php cannot be found – go to Display Results tab to fix

    #44354

    In reply to: Configure not showing


    Anonymous
    Inactive

    This is the output with results.php

    http://www.thoughtmechanics.co.uk/search/?_sft_category=apartment

    I will send you the result page with shortcodes, however the portfolio text is below image.

Viewing 10 results - 1,001 through 1,010 (of 1,224 total)