Skip to content

Instantly share code, notes, and snippets.

@emaildano
Created January 17, 2014 19:38
Show Gist options
  • Save emaildano/8480006 to your computer and use it in GitHub Desktop.
Save emaildano/8480006 to your computer and use it in GitHub Desktop.
Grab the most recent post from a category. This example is from Griggstown farm.
<?php
$args = array( 'numberposts' => 1, 'category_name' => 'food-of-the-week' );
$postslist = get_posts( $args );
foreach ($postslist as $post) : setup_postdata($post); ?>
<h4><?php the_time('D, F jS, Y') ?></h4>
<h3><?php the_title(); ?></h3>
<p><?php echo bm_better_excerpt(431, ' ... ') ?></p>
<a href="<?php the_permalink(); ?>">Learn More</a>
<?php endforeach; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment