Quantcast
Channel: WordPress.org Forums » [Jetpack - WP Security, Backup, Speed, & Growth] Support
Viewing all articles
Browse latest Browse all 37018

pealo86 on "[Plugin: Jetpack by WordPress.com] Infinite Scroll Not Working on Custom Posts"

$
0
0

I'm trying to use IS on the WP theme I'm building. I can get it to work fine on my posts page, however I'm having no luck on a page that feeds in custom posts. And the code for each is near identical.

Here's the functions I've set up:

// enable infinite scroll
function infinite_scroll_render() {
	get_template_part('loop', 'feed-headscape-shot');
}

function infinite_scroll_init() {
    add_theme_support( 'infinite-scroll', array(
        'container'      => 'feed',
        'footer_widgets' => 0,
        'footer'         => 'page',
        'posts_per_page' => 1,
        'render'         => 'infinite_scroll_render'
    ) );
}
add_action( 'init', 'infinite_scroll_init' );

Here's loop-feed-headscape-shot.php:

<?php if(have_posts()) : ?>

	<div id="feed-headscape-shot" class="feed-headscape-shot">
		<div id="feed" class="feed">
			<?php while(have_posts()) : the_post(); ?>

				<?php if (has_post_thumbnail()) : ?>

					<figure>
						<?php if (get_field('left')) : ?><img class="left" src="<?php echo the_field('left'); ?>" alt="<?php the_title(); ?>" /><?php endif; ?>
						<?php if (get_field('right')) : ?><img class="right" src="<?php echo the_field('right'); ?>" alt="<?php the_title(); ?>" /><?php endif; ?>
						<img src="<?php echo getPostThumbnailUrl('feed-headscape-shot'); ?>" alt="<?php the_title(); ?>" />
					</figure> 

				<?php endif; ?>

			<?php endwhile; ?>
		</div>

		<?php get_template_part('include', 'paginate'); ?>

	</div>

<?php endif; ?>

Can anyone see what I'm doing wrong? I can tell it's not working because it pulls in the number of items specified from 'Settings > Reading' as opposed to my posts_per_page option specified in my function

http://wordpress.org/plugins/jetpack/


Viewing all articles
Browse latest Browse all 37018

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>