-
AuthorSearch Results
-
May 25, 2020 at 9:54 am #245685
In reply to: Issue with getting previous posts
RossKeymasterHi 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
May 25, 2020 at 8:18 am #245671In reply to: style results page with Thrive Architect
AnonymousInactiveWell, 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
RobertMay 22, 2020 at 12:05 pm #245464In reply to: Issue with getting previous posts
AnonymousInactiveHello Ross,
I have converted my code to a custom WP Query.
Code now: https://pastebin.com/gLrvSCHSPreviously I used the code provided in the results.php, but that did not work either…
May 20, 2020 at 5:31 pm #245168In reply to: style results page with Thrive Architect
TrevorParticipantI 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"; } ?>
May 20, 2020 at 5:18 pm #245163In reply to: Matching Infinite Scroll on Front Page
AnonymousInactiveFor 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.
May 20, 2020 at 3:15 pm #245145In reply to: Issue with getting previous posts
RossKeymasterHi 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
andnext_posts_link
apparently support custom queries if you addmax_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-resultsThanks
May 20, 2020 at 1:47 pm #245128In reply to: Matching Infinite Scroll on Front Page
AnonymousInactiveNot 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.
May 19, 2020 at 4:53 pm #244940In reply to: Divi Infinite Scroll Blog Module
RossKeymasterSo 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 onsf:ajaxfinish
– https://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-titleThanks
May 18, 2020 at 12:33 pm #244468
AnonymousInactiveHi 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.
May 15, 2020 at 2:14 am #244034In reply to: Changing the way results are shown
AnonymousInactiveSo 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
-
AuthorSearch Results