function test_largo_load_more_posts_data()
 {
     // create $shown_ids
     global $wp_scripts, $wp_query, $shown_ids;
     $args = array('post_type' => 'post');
     $wp_query = new WP_Query($args);
     if ($wp_query->have_posts()) {
         while ($wp_query->have_posts()) {
             $wp_query->the_post();
             $shown_ids[] = get_the_ID();
         }
     }
     $this->expectOutputRegex('/script/');
     largo_load_more_posts_data('test_nav', $wp_query);
 }
Example #2
0
<?php

/*
 * Set $wp_query so that `next_posts_link` works properly
 */
global $wp_query;
$original_query = $wp_query;
$wp_query = $the_query;
?>
<nav id="<?php 
echo $nav_id;
?>
" class="pager post-nav">
	<div class="load-more">
		<?php 
$label = apply_filters('largo_next_posts_link', __('Load more ', 'largo') . strtolower($posts_term));
?>
		<?php 
next_posts_link($label);
?>
	</div>
	<?php 
largo_load_more_posts_data($nav_id, $wp_query);
?>
</nav>
<?php 
/*
 * Restore $wp_query
 */
$wp_query = $original_query;