Advertisement
ridgey28

Get 20 latest WP posts and Date

Jan 8th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1.  <?php $args = array( 'numberposts' => 20, 'post_status'=>"publish",'post_type'=>"post",'order'=>"DESC",'orderby'=>"post_date");
  2.     $postslist = get_posts( $args );?>
  3.     <ul id="events" class="test">
  4.  
  5.         <?php foreach ($postslist as $post) : setup_postdata($post); ?>
  6.        
  7.             <li>
  8.                 <?php the_date('F d');?><br/>
  9.                 <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
  10.             </li>
  11.      
  12.     <?php endforeach; ?>
  13.     </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement