Infinity Post Load

5 replies · opened Jun 13, 2019

Ggoodluck2911Jun 13, 2019

Dear team,

My site is https://1mg.vn/

I am trying to add Infinity Load to Posts. But it is not worked.

Please help me check the below codes that I copied from templates.

Many thanks team

====JS====
<script>
jQuery(window).on( 'load', function(){
var $container = $('.infinity-wrapper');
$container.infiniteScroll({
path: '.load-next-posts',
history: false,
status: '.page-load-status',
});
$container.on( 'load.infiniteScroll', function( event, response, path ) {
var $items = $( response ).find('.infinity-loader');
// append items after images loaded
$items.imagesLoaded( function() {
$container.append( $items );
$container.isotope( 'insert', $items );
setTimeout( function(){
SEMICOLON.initialize.resizeVideos();
SEMICOLON.initialize.lightbox();
SEMICOLON.widget.loadFlexSlider();
}, 1000 );
});
});
});
</script>

====HTML====
<div class="text-center">
<div class="page-load-status hovering-load-status">
<div class="css3-spinner infinite-scroll-request">
<div class="css3-spinner-ball-pulse-sync">
<div></div>
<div></div>
<div></div>
</div>
</div>
<div class="alert alert-warning center infinite-scroll-last mx-auto" style="max-width: 20rem;">End of content</div>
<div class="alert alert-warning center infinite-scroll-error mx-auto" style="max-width: 20rem;">No more pages to load</div>
</div>
</div>
<div class="center d-none">
/template-parts/content-excerpt.php?p=2" class="button button-3d button-dark button-large button-rounded load-next-posts">Load more..
</div><!-- #loader end -->

====Loop====
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'template-parts/content-excerpt', get_post_format() );?>
<?php endwhile; ?>

<?php else : ?>
<?php get_template_part( 'template-parts/content', 'none' );?>

<?php endif; ?>

SSemicolon WebSTAFFJun 13, 2019

Hello,

The Link you have defined: https://1mg.vn/wp-content/themes/mgvn/template-parts/content-excerpt.php?p=2 that loads the Next set of Posts in returning a PHP Error which is the reason why the Infinity Scroll is not working. Fixing this error will automatically solve your issue.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

SSemicolon WebSTAFFJun 14, 2019

Hello,

You are using WordPress, so ideally your link should look like this: https://1mg.vn/page/2 and so on.

Also, you should consider using: https://codex.wordpress.org/Function_Reference/next_post_link for generating your Next Page Links automatically.

You will need to do this yourself or Hire a Freelancer to help you with this as we currently do not provide Customization related Support according to the Item Support Policy: https://themeforest.net/page/item_support_policy .

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Ggoodluck2911Jun 14, 2019

thanks team very much.
you advice is so worthy for me.
Have a nice day

SSemicolon WebSTAFFJun 15, 2019

Hello,

Always happy to help you! :)

Do let us know if we can help you with anything else or if you find any further issues with Canvas.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard