Forums Forums Search Search Results for 'results.php'

Viewing 10 results - 151 through 160 (of 1,224 total)
  • Author
    Search Results
  • #245685

    Ross
    Keymaster

    Hi Thomas

    I’m not sure why that wouldn’t work – if you use display method “shortcode” and then use our template “results.php” you will see it working?

    Do you have a link I could look at?

    Thanks

    #245671

    Anonymous
    Inactive

    Well, it is a bit to complicated for my skills, I think. I started to create a own results.php. While doing this I encountered that this is much more flexible for my needs.

    Best
    Robert

    #245464

    Anonymous
    Inactive

    Hello Ross,

    I have converted my code to a custom WP Query.
    Code now: https://pastebin.com/gLrvSCHS

    Previously I used the code provided in the results.php, but that did not work either…

    #245168

    Trevor
    Participant

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

    Anonymous
    Inactive

    For now, if you look at the front page, you’ll see infinite scroll using another 3rd party library. I’m just going to wire up https://wordpress.org/plugins/catch-infinite-scroll/.

    I don’t see how S&FPro can be used for the initial content that is rendered on the front page. Because the front page loop comes from “have_posts()” and “the_post()” where as results.php requires”$query->have_posts()” and “$query->have_posts()”. and there is no query yet.

    Please let me know if I’m wrong, it would be nice to avoid adding additional, duplicating, libraries to our payloads.

    #245145

    Ross
    Keymaster

    Hi Thomas

    It looks like you are uinsg display method = shortcode?

    That uses a $query for the results – otherwise known as a “custom query”.

    The function previous_posts_link and next_posts_link apparently support custom queries if you add max_num_pages as the second parameter (I didn’t test this):

    https://stackoverflow.com/a/15567906

    Alternatively, you can use the code provided in the results.php template file in our plugin:
    https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results

    Thanks

    #245128

    Anonymous
    Inactive

    Not sure what you mean by “same” template?

    I have a very simple template structure, it’s all very hard coded. The outer loop is in index.html and it calls content-x
    index.html -> content-x.

    If it’s a Page (results page) it goes to content-page.php. If it’s front page, it goes to content.php. content-page.php does pretty much nothing more than output the shortcode for results, which then uses your results.php for the loop. I customised results.php to actually then call content.php – so blog entries uses the same template for both routes. In both cases we have an outer (outside the loop) #blog-posts div.

    For the configuration of the shortcode. I couldn’t get post/result selector to work, so I used Infinite Scroll Container which is set to #blog-posts.

    #244940

    Ross
    Keymaster

    So the logic would be:

    1) Insert the new page title into a hidden input field in your results.php – something like:
    <input type="hidden" id="new-page-title" value="<?php echo get_the_title(); ?>" />
    1) When an ajax request finishes, get the new page title from #new-page-title.
    a) You can perform actions on sf:ajaxfinishhttps://searchandfilter.com/documentation/faq/
    b) then you can put that value into the document title – document.title = ...https://stackoverflow.com/questions/413439/how-to-dynamically-change-a-web-pages-title

    Thanks


    Anonymous
    Inactive

    Hi Trevor,

    This is where we had the file and re-tested just now to be sure.

    /child-theme-folder/search-filter/templates/results.php

    Only works in:

    /master-theme-folder/search-filter/templates/results.php

    Regards, Jake.

    #244034

    Anonymous
    Inactive

    So I did end up finding what I wanted here : https://searchandfilter.com/documentation/search-results/using-a-shortcode/

    You can simply create a results.php file in your own child-theme, based out of the one provided in the plugin.

    I’ll start tweaking it and I should be good to go.

    Regards

Viewing 10 results - 151 through 160 (of 1,224 total)