Skip to content

Instantly share code, notes, and snippets.

@hsquareweb
Created April 26, 2012 19:41
Show Gist options
  • Save hsquareweb/2502448 to your computer and use it in GitHub Desktop.
Save hsquareweb/2502448 to your computer and use it in GitHub Desktop.
WP: Pull Posts
<ul>
<?php global $post;
$args = array( 'numberposts' => 4, 'category' => 6, 'orderby' => 'post_date', 'post_status' => 'publish' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<li>
<div class="cal">
<span class="month"><?php the_time('M'); ?></span>
<span class="day"><?php the_time('j'); ?></span>
</div>
<p>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a><br/>
<?php echo get_post_meta($post->ID, 'Event Date', true); ?><br/>
<?php echo get_post_meta($post->ID, 'Event Place', true); ?><br/>
<?php echo get_post_meta($post->ID, 'Event Location', true); ?>
</p>
</li>
<?php endforeach; ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment