Skip to content

Instantly share code, notes, and snippets.

@jonathan-bird
Created August 19, 2013 23:12
Show Gist options
  • Save jonathan-bird/6275299 to your computer and use it in GitHub Desktop.
Save jonathan-bird/6275299 to your computer and use it in GitHub Desktop.
Wordpress: Blog Page - Simple Title & Description
<?php
/*
Template Name: Blog
*/
?>
<?php get_header(); ?>
<div class="container">
<article id="content">
<?php
$temp = $wp_query; $wp_query= null;
$wp_query = new WP_Query(); $wp_query->query('showposts=5' . '&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<h2><a href="<?php the_permalink(); ?>" title="Read more"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
<?php endwhile; ?>
<?php if ($paged > 1) { ?>
<nav id="nav-posts">
<div class="prev"><?php next_posts_link('&laquo; Previous Posts'); ?></div>
<div class="next"><?php previous_posts_link('Newer Posts &raquo;'); ?></div>
</nav>
<?php } else { ?>
<nav id="nav-posts">
<div class="prev"><?php next_posts_link('&laquo; Previous Posts'); ?></div>
</nav>
<?php } ?>
<?php wp_reset_postdata(); ?>
</article>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment