Replies: 0
I’ve got infinite scroll working flawlessly on a local dev environment as well as a staging site here: http://bencross.co/igr/
for some reason, the infinite scroll is not working here: https://indiegamereviewer.com/
this theme is custom built based on the _s starter theme and is using a modified version of the included Jetpack support file:
<?php
/**
* Jetpack Compatibility File.
*
* @link https://jetpack.com/
*
* @package IGR
*/
/**
* Jetpack setup function.
*
* See: https://jetpack.com/support/infinite-scroll/
* See: https://jetpack.com/support/responsive-videos/
*/
function igr_jetpack_setup() {
// Add theme support for Infinite Scroll.
add_theme_support( 'infinite-scroll', array(
'container' => 'main',
'render' => 'igr_infinite_scroll_render',
'footer' => 'page',
'posts_per_page' => 12,
) );
// Add theme support for Responsive Videos.
add_theme_support( 'jetpack-responsive-videos' );
}
add_action( 'after_setup_theme', 'igr_jetpack_setup' );
/**
* Custom render function for Infinite Scroll.
*/
function igr_infinite_scroll_render() {
$post_count = 0;
while ( have_posts() ) {
if ( is_active_sidebar( 'archive-leaderboard' ) && $post_count == 6 ) : ?>
<div class="archive-ad">
<?php dynamic_sidebar( 'archive-leaderboard' ); ?>
<p class="ad-id">advertisement</p>
</div><!-- .ad-atf -->
<?php endif;
the_post();
get_template_part( 'template-parts/content-excerpt', get_post_format() );
$post_count++;
}
}
/**
* Custom Infinite Footer for Jetpack Infinite Scroll.
*/
function igr_custom_infinite_footer() { ?>
<div id="infinite-footer" class="infinite-footer">
<div class="container">
<?php wp_nav_menu( array( 'theme_location' => 'footer', 'menu_class' => 'footer-menu' ) ); ?>
<div class="site-copyright">
<p>Copyright © 2008 - <?php echo the_date(Y); ?> indiegamereviewer.com</p>
</div>
</div>
</div>
<?php }
/**
* Custom Filter to replace the JetPack Infinite Scroll Footer
**/
function igr_infinite_scroll_settings( $args ) {
if ( is_array( $args ) )
$args['footer_callback'] = 'igr_custom_infinite_footer';
return $args;
}
add_filter( 'infinite_scroll_settings', 'igr_infinite_scroll_settings' );
As I mentioned this is working on two separate “clones” of the site. Please help!
Thanks!
-
This topic was modified 20 minutes ago by bencross02.