Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 23rd, 2012  |  syntax: PHP  |  size: 0.47 KB  |  views: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function NewCoupons($num=5){
  2.  
  3.  
  4.                 global $wpdb;
  5.                 $STRING = "";
  6.        
  7.                 $query = array (
  8.         'posts_type' => 'post',
  9.         'orderby' => 'date',
  10.         'order'=> 'DESC'
  11.                 );
  12.                 $posts = new WP_Query($query);
  13.  
  14.                 foreach($posts as $post){
  15.  
  16.                 $STRING  .="<li><a href='".get_permalink($post->ID)."'>".$post->post_title."</a> - <em>".get_post_meta($post->ID, 'hits', true)." ".$GLOBALS['_LANG']['_tpl_edit_b3']."</em></li>";
  17.                
  18.                 }
  19.  
  20.                 wp_reset_query();
  21.                
  22.                 print $STRING;
  23. }
clone this paste RAW Paste Data