Forums › Forums › Search & Filter Pro › Matching Infinite Scroll on Front Page
Tagged: infinite scroll
- This topic has 25 replies, 2 voices, and was last updated 4 years, 6 months ago by Ross.
-
Anonymous(Private) May 20, 2020 at 3:54 am #245005
We want our “unfiltered” (front page) and “filtered” (results) pages to look the same to our users.
http://blog.kie.orgHow do I get the unfiltered front page to match the infinite scroll of the filtered results view, without having to use another 3rd party library? If I have to use a 3rd party, any recommendations to which gives same end user experience as that provided by S&FPRO? I’m currently looking at:
https://wordpress.org/plugins/catch-infinite-scroll/Trevor(Private) May 20, 2020 at 9:46 am #245052I think I understand. You want to have Infinite Scroll on the Home page, and for it to look like the results page? Do both pages use the same or similar templates? I do not think that they do. What do you have these settings set to:
https://www.screencast.com/t/Sp1Yt4m30c
The structure (classes) of both would need to be repeated (at least, the ones on the results page need to be used on the Homepage, as well as what is already there).
Anonymous(Private) May 20, 2020 at 1:47 pm #245128Not 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.
Anonymous(Private) May 20, 2020 at 5:18 pm #245163For 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.
Trevor(Private) May 21, 2020 at 10:26 am #245267You could make a duplicate form so that the new (duplicate) is on the Home page. As the form redirects to the other page, all it actually needs to do is add Infinite Scroll. Now the form is different, you can set different containers for the Infinite Scroll.
You may be able to set the display results method to Custom (as you are not actually going to filter on the Home Page, there is no need to link the filtering part of of plugin to the posts there) and make sure that the ‘Only use Ajax on the results page?’ setting is ON.
Anonymous(Private) May 21, 2020 at 7:04 pm #245374having some issues with this. It’s rendering the results with the shortcode, but no infinite scroll on ‘from’ page, fine on ‘filtered’ page.
I have duplicated the form. One for ‘front’ page the other for ‘filtered’. ‘filtered’ works as before and is fine.
The ‘front’ page is set to custom, ajax set to use the filtered page. infinite scroll left same as ‘filtered’, i.e. targeting container #blog_posts. In my template I replaced the_loop with the follow:
if ( is_front_page() ) :
$args = array(‘post_type’ => ‘post’);
$args[‘search_filter_id’] = 3502;
$query = new WP_Query($args);
echo do_shortcode(‘[searchandfilter id=”3502″ show=”results”]’);
else :
if ( have_posts() ) :
while ( have_posts() ) : the_post();
get_template_part( ‘content’, ‘page’ );
endwhile;
endif;
endif;Anonymous(Private) May 22, 2020 at 12:12 pm #245465As mentioned we have a custom theme. It has only an index.html that is used for the ‘front’ page and ‘filter’. We followed this:
https://www.taniarascia.com/developing-a-wordpress-theme-from-scratch/We actually didn’t add pagination yet, as your infinite scroll on the ‘filtered’ page just worked.
-
AuthorPosts