Hey guys,
Goal: to display, preferably at best, most recent post, one post at the time with pagination works like when we select Latest Posts
in Settings. Basically it looks like this: http://trisha.gopagoda.com/
But right now, I’m stuck with this output: http://daiyantrisha.gopagoda.com/
Which is not too bad. But on the second page upon click the Post 2
(which is essentially a previous post/page linkback), on Post 2
itself I don’t have pagination loaded. Maybe emulating what’s in my goal (see first link) is good enough for me.
Here’s the code I have for my content.php
; Github gist
<?php $the_query = new WP_Query( 'showposts=1' ); ?>
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
<?php the_content(__('(more…)')); ?>
<?php endwhile;?>
<div id="cooler-nav" class="navigation">
<?php $prevPost = get_previous_post(true);
if($prevPost) {?>
<div class="nav-box previous">
<?php previous_post_link('%link',"<p>%title</p>", TRUE); ?>
</div>
<?php } $nextPost = get_next_post(true);
if($nextPost) { ?>
<div class="nav-box next" style="float:right;">
<?php next_post_link('%link',"<p>%title</p>", TRUE); ?>
</div>
<?php } ?>
</div>
While for the Latest Posts
view, it loads this index.php
that looks like this; GIthub gist
<?php get_template_part('templates/page', 'content'); ?>
<?php if (!have_posts()) : ?>
<div class="alert alert-warning">
<?php _e('Sorry, no results were found.', 'roots'); ?>
</div>
<?php get_search_form(); ?>
<?php endif; ?>
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('templates/content', get_post_format()); ?>
<?php endwhile; ?>
<?php if ($wp_query->max_num_pages > 1) : ?>
<nav class="post-nav">
<ul class="pager">
<li class="previous"><?php next_posts_link(__('← Older posts', 'roots')); ?></li>
<li class="next"><?php previous_posts_link(__('Newer posts →', 'roots')); ?></li>
</ul>
</nav>
<?php endif; ?>
I’ve searched throughout the forum and saw some posts by @enollo but so far all the solutions shared for the pagination_simple
inside functions.php
or libs/scripts.php
doesn’t work on my end.
Please advise and thank you your concern!