Skip to content

Instantly share code, notes, and snippets.

@theStreets93
Last active January 3, 2016 14:09
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 theStreets93/988365ac51d7fc0106ac to your computer and use it in GitHub Desktop.
Save theStreets93/988365ac51d7fc0106ac to your computer and use it in GitHub Desktop.
WP Query post
<?php
$args = array(
'cat' => '2',
'showpost' => 5
);
query_posts( $args );
while ( have_posts() ) : the_post();
?>
<div class="post-wrapper">
<?php the_post_thumbnail('size', array('class' => 'post-image')); ?>
<h2><?php the_title(); ?></h2>
<div class="excerpt"><?php the_excerpt(); ?></div>
<a href="<?php the_permalink(); ?>">View more</a>
</div>
<?php
endwhile;
wp_reset_query();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment