Forums Forums Search Search Results for 'results.php'

Viewing 10 results - 141 through 150 (of 1,224 total)
  • Author
    Search Results

  • Ross
    Keymaster

    Hi Boris

    Sorry for the confusion. The chrome thing, just means that I have the browser cache disabled while I have the developer tools open:
    https://stackoverflow.com/a/7000899

    So, when I test the page, with my developer tools open, chrome effectively ignores your sites instruction to cache the request for X amount of days… So we can see that the issue (at least on development) is caching issue.

    Also, this issue is present with all plugins except S&F and your post type plugin disabled.

    I think what you mention about the htaccess might be the key and it looks like its working for me.

    BTW, I noticed you recreated your search form, but you used the post meta key _accom_max_occupancy_new (which is something I created just for testing), which naturally led to 0 results.. it should be accom_max_occupancy and that now looks like it works.

    To test if the caching is still on, all you need to do is edit search-filter/results.php and change the template, then see if the results format is updated on an ajax request on the frontend, or if you are seeing the old version.

    Thanks

    #247122

    Trevor
    Participant

    Do you actually have posts with the audio files inserted already in the content?

    If so, can you follow this setup for now:

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

    In particular, follow the instructions in the Customising section.

    That will give you a results.php file you can edit, in a sub-folder named search-filter in your theme folder.

    You need to find this line:

    <p><br /><?php the_excerpt(); ?></p>

    and replace it with something like:

    <p><?php echo get_the_content(); ?></p>

    You can edit pretty much anything in this file, but make small changes and test.

    #247098

    Trevor
    Participant

    If you use the method shown in the link, and NOT our Shortcode Display Result method, there should not be anything to translate. What is it that you need to translate?

    The form on the search page still uses the Shortcode method. If you want to stay with that, it is OK, but you need to follow the customising guide here:

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

    And use the numbering the filename option instead of a generic results.php file (e.g. name one language the file 15925.php), and then you can translate those strings directly in the specific language versions. Each language will have its own form with its own ID number that you use.

    #246641

    Anonymous
    Inactive

    I do, thanks. However, it’s now outputting the text ‘ArrayAntigonish’ (or ‘Array’ + whatever county is selected) and it’s not outputting category name. I have tried to puzzle through this to see if I can work out how to fix it myself but my PHP just isn’t good enough.

    Here’s a link to a sample results page.

    What I’d like it to say is something like “You searched for Breweries, Distilleries, and Vineyards in Antigonish County” and then the results.

    Below is the full code of results.php. If you can offer any more insight I’d be grateful.

    <?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 this file is called directly, abort.
    if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    }
    
    if ( $query->have_posts() )
    {
    	?>
    	
    	There are <?php echo $query->found_posts; ?> posts that match your search! <br />
    
    	<?php
    	
    	 global $searchandfilter;
    	 
    $sf_current_query = $searchandfilter->get(1949)->current_query()->get_array();
    
    echo implode(", ",$sf_current_query['_sft_category']['active_terms']);
    $county = $sf_current_query["_sfm_county"]["active_terms"][0]["value"];
    if ($county) {
    echo $county;
    } else {
    echo "All Counties";
    }
    	
    
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
    		<div>
    			<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    			
    			<p><?php the_excerpt(); ?></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( 'Next page', $query->max_num_pages ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( 'Previous page' ); ?></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";
    }
    ?>
    #246624

    Anonymous
    Inactive

    I popped in the first two lines of PHP you recommended but it throws this error for the second line:

    Fatal error: Uncaught Error: Cannot use object of type Search_Filter_Active_Query as array in /home/willi413/public_html/novascotiafood.com/wp-content/themes/nova-scotia-food/search-filter/results.php:51 Stack trace: #0 /home/willi413/public_html/novascotiafood.com/wp-content/plugins/search-filter-pro/public/includes/class-search-filter-query.php(1148): include() #1 /home/willi413/public_html/novascotiafood.com/wp-content/plugins/search-filter-pro/public/includes/class-search-filter-display-results.php(48): Search_Filter_Query->the_results() #2 /home/willi413/public_html/novascotiafood.com/wp-content/plugins/search-filter-pro/public/includes/class-search-filter-display-shortcode.php(884): Search_Filter_Display_Results->output_results(1949, Array) #3 /home/willi413/public_html/novascotiafood.com/wp-includes/shortcodes.php(343): Search_Filter_Display_Shortcode->display_shortcode(Array, ”, ‘searchandfilter’) #4 [internal function]: do_shortcode_tag(Array) #5 /home/willi413/public_html/novascotiafood.com/wp-includes/shortcod in /home/willi413/public_html/novascotiafood.com/wp-content/themes/nova-scotia-food/search-filter/results.php on line 51

    #246248

    Trevor
    Participant

    That issue is simply the way that whatever code outputs the posts handles a ‘No Results Found’ scenario. As you are using our Shortcode method, and thus the infinite scroll version of results.php, this customized version handles ‘No Results’ better I think:

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

    Try using that instead?

    #245996

    Trevor
    Participant

    You do indeed need different code, as the ‘categories’ are actually a custom taxonomy. I assume you have followed the guidance in this guide to customising the results.php template:

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

    The actual code you would use MIGHT look like this:

    $terms = wp_get_post_terms(get_the_ID(), 'project_category');
    if ($terms) {
      $output = array();
      foreach ($terms as $term) {
        $output[] =  $term->name ;
      }
      echo join( ', ', $output );
    };

    And also remove the code relating to tags and categories.

    #245877

    In reply to: different views


    Trevor
    Participant

    I am not sure what you mean by different view, but do you mean you want to be able to choose between two different layouts? You might need to significantly customize the results.php code so that the loop produces a tabbed area where the user can switch between the tabs. You might have two output string variables (one for each view) and instead of echoing directly to the page, the loop would concetenate into those variables, and after the loop is completed, those are then output into the custom HMTL you would have written.

    Further than that, I cannot help you as this is not really within the scope of our support, but a good third party coder should be able to do this.

    #245875

    Trevor
    Participant

    Assuming you are using the Shortcode Display Results method:

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

    If so, I assume/hope you copied (to the child theme search-results folder you would have made) the results-infinite-scroll.php template instead of the results.php template when you followed the customising guide there? It still needs to be named results.php in the child theme, so it would need renaming.

    #245792

    Anonymous
    Inactive

    its even not changing from results.php template to results-infinite-scroll.php,
    nothing changes

Viewing 10 results - 141 through 150 (of 1,224 total)