Infinite scroll not loading posts
-
Hi, I have a problem with my custom template for WordPress site. I’m trying to add infinite scroll to my website. On home page from infinite scroll functionality is working only sticky footer but do not load additional posts. This footer seems not working on posts page (single) and also not loading next posts.
Example: https://overwatchleague.pl/news/london-spitfire-reprezentant-europy-koreanskim-wydaniu/
So I’ve added support for IS in my function.php:
function ow_jetpack_setup() { add_theme_support( 'infinite-scroll', array( 'container' => 'art', 'footer' => 'footer', 'render' => 'ow_render_infinite_scroll', ) ); } add_action( 'after_setup_theme', 'ow_jetpack_setup' );
Then in single.php I’ve tried to get this working:
<?php get_header(); ?> <!-- BEGIN .content --> <div class="container"> <div id="art"> <?php function ow_render_infinite_scroll() { while (have_posts()) { the_post(); $post_type = get_post_type(); get_template_part( 'content', $post_type ); } } ?> </div> </div> <?php get_footer(); ?>
Of course header.php has added wp_head inside and footer.php has added wp_footer.
But with that function IS is not working and also content is not showing with template from file content-single.php – it’s showing blank div. When I comment function content is showing but IS is still not working.
What am I doing wrong?
The page I need help with: [log in to see the link]
- The topic ‘Infinite scroll not loading posts’ is closed to new replies.