Skip to content

Instantly share code, notes, and snippets.

@anthonysbrown
Created April 27, 2016 01:27
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 anthonysbrown/ee0b8188313f91d00b5d3135ad34a443 to your computer and use it in GitHub Desktop.
Save anthonysbrown/ee0b8188313f91d00b5d3135ad34a443 to your computer and use it in GitHub Desktop.
<?php
// the query
$args = array(
'post_type' => 'post',
'posts_per_page' => 1,
);
$the_query = new WP_Query( $args ); ?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<h2><?php the_title(); ?></h2>
<header>
<h2 class="title entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></h2></a></header>
<div class="post-meta"><abbr class="date time published updated" ><?php the_date(); ?></abbr></div>
<section class="entry">
<?php the_content(); ?>
</section><!-- /.entry -->
<div class="fix"></div>
<div class="post-more">
<span class="read-more"><a href="<?php the_permalink(); ?>" title="Continue Reading">Continue Reading</a></span> </div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php _e( 'Sorry, no posts.' ); ?></p>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment