Skip to content

Instantly share code, notes, and snippets.

@ajmalafif
Last active December 26, 2015 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajmalafif/7202313 to your computer and use it in GitHub Desktop.
Save ajmalafif/7202313 to your computer and use it in GitHub Desktop.
<?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>
<?php get_template_part('templates/page', 'header'); ?>
<?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(__('&larr; Older posts', 'roots')); ?></li>
<li class="next"><?php previous_posts_link(__('Newer posts &rarr;', 'roots')); ?></li>
</ul>
</nav>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment