Forums › Forums › Search & Filter Pro › Infinite scroll is loading too many pages at once.
- This topic has 7 replies, 2 voices, and was last updated 3 years, 12 months ago by Trevor.
-
Anonymous(Private) November 10, 2020 at 12:25 pm #265794
Hi there!
I’ve struggled couple of times with this problem already, but i found no solution.
So, on results page Ajax loading is set on. Pagination Type is set as Infinite scroll > http://prntscr.com/vgprly
The problem is that when i scroll down, at the beginning it’s loading fine, then it loads faster and faster and the screen is jumping up some rows, see here please > https://gyazo.com/770ee91aa09bd7826be7204482659268
Hope the short video above explains enough the problem at hand…
Notice the featured image with the pencil tick on page, i scroll down, but all search results are jumping way higher.So what’s you thoughts?
How can i fix it?Trevor(Private) November 10, 2020 at 4:24 pm #265839I would need to see the code for results.php, but it does not look right that you have no Infinite Scroll Container. It should enclose the posts (with class ‘item’), like this (I made the code to show you, it is not in your page):
https://www.screencast.com/t/LVczF9Tk8P
If that does not work, can you show me the results.php file contents? You can share the file using a file sharing site, or post/paste the code in your reply here. Please post any code inside code ticks (one before the code, one after)? On my UK Windows keyboard, the code tick key is next to the 1 key in the standard part of the keyboard. If you do this Google search and look at the images, they show various keyboards and where the key is located:
Anonymous(Private) November 11, 2020 at 8:59 am #265955Thanks for quick reply Trevor!
Ok, i tried to set the results in a container, but .results-header got multiplied a lot of times, so i had to go back where i started.
Help me please further with this problem.
here the link to the code > https://www.codepile.net/pile/DOr3jnYo
(photo link just in case 🙂 > http://prntscr.com/vh9mq9 )As you see, i use the shortcode for the search form, next i use shortcode for displaying the results. Both on the same page.
What am i doing wrong?Anonymous(Private) November 11, 2020 at 12:26 pm #266018Sorry Trevor, i guess you actually need to check this code rather than first one i sent > https://www.codepile.net/pile/oY99pRYr
Trevor(Private) November 11, 2020 at 5:15 pm #266107Here is my version of that code, with new lines 30 and 58:
<?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 ( $query->have_posts() ) { ?> <div class="results-head clear"> <h1><?php _e('Nieuws & Blog artikelen','best4u');?></h1> </div> <div class='search-filter-results-list'> <?php while ( $query->have_posts() ) : $query->the_post(); // $query->the_post(); $id = get_post()->ID; $image = get_the_post_thumbnail_url( $id, 'medium_large' ); $title = get_the_title( $id ); $permalink = get_the_permalink( $id ); ?> <div class="item span-4"> <?php if ( $image ): ?> <div class="latest-news__thumb object-fit sz-16-9"> <a href="<?php echo $permalink; ?>" ><img class="lazy-img lazy" data-src="<?php echo $image; ?>" src="<?php echo get_template_directory_uri() ?>/placeholder.png" alt="<?php echo $title ?>"></a> </div> <?php endif; ?> <div class="latest-news__cnt"> <h3><a href="<?php echo $permalink; ?>"><?php echo $title; ?></a></h3> <div class="content"> <?php echo my_content( 20, false, false ); ?> </div> <div class="link"> <a href="<?php echo $permalink; ?>" class="read-more"><?php _e( 'Lees meer', 'best4u' ); ?></a> </div> </div> </div> <?php endwhile; ?> </div> <?php if ( function_exists( 'wp_pagenavi' ) ) { ?> <div class="pagination"> <?php wp_pagenavi( array( 'query' => $query ) ); ?> </div> <?php } ?> <?php } else {?> <h3><?php _e('Geen resultaten gevonden','best4u')?></h3> <?php } ?>
-
AuthorPosts