Skip to content

Instantly share code, notes, and snippets.

@lelandsmith
Created March 12, 2014 00:15
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 lelandsmith/9497912 to your computer and use it in GitHub Desktop.
Save lelandsmith/9497912 to your computer and use it in GitHub Desktop.
WP: Get Posts Query Loop
<?php
$args = array( 'numberposts' => 1, 'offset'=> 2, 'category' => 19 );
$lastposts = get_posts( $args );
foreach($lastposts as $post) : setup_postdata($post); ?>
<h2 style="font-size: 26px;"><a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a></h2>
<?php the_time('F jS, Y') ?> | <?php the_author_link(); ?> | <a href="<?php the_permalink(); ?>/#respond" title=""><?php comments_number('0'); ?></a>
<div class="copy">
<?php the_excerpt() ;?>
</div>
<?php endforeach; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment