I know this sounds illogical and maybe it is, but the client's asked for it so I'm looking into a solution if possible.
On a section of the site there's a link that leads to category-news.php, which displays all posts belonging to News. The user loads each of these posts dynamically through the use of InfiniteScroll, with the posts being paginated beforehand.
The client has requested to also want this feature when viewing a single post item of the same category (i.e. "View more"). I can't seem to create a pagination for single.php, and would like to know if this is even possible to begin with? What happens now is that I get only 1 additional post beyond the current.
Here's the code for single.php so far -
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $currentID = get_the_ID(); ?>
<article>
<section>
<?php the_post_thumbnail( array(466,9999) ) ?>
</section>
<section>
<h1><?php the_title() ?></h1>
<h6><?php the_date() ?></h6>
<div class="share"><span class='st_sharethis_custom'>Share</span></div>
<?php the_content(); ?>
</section>
</article>
<?php endwhile; endif; ?>
<?php
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$news = new WP_Query( array('cat' => 3, 'paged' => $paged, 'posts_per_page' => 1, 'post__not_in' => array($currentID), 'orderby' => 'date', 'order' => 'DESC') );
while ($news->have_posts()) : $news->the_post();
?>
<article>
<section>
<?php the_post_thumbnail( array(466,9999) ) ?>
</section>
<section>
<h1><?php the_title() ?></h1>
<h6><?php the_date() ?></h6>
<div class="share"><span class='st_sharethis_custom'>Share</span></div>
<?php the_content(); ?>
</section>
</article>
<?php endwhile; endif; ?>
<div class="infiniteScroll"><?php next_posts_link('') ?></div>
(Running the current post first, then adding a WP Query to retrieve the rest.)