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

YARPP custom template

By: a guest on Apr 25th, 2013  |  syntax: PHP  |  size: 0.66 KB  |  views: 29  |  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. <?php if (have_posts()):
  2.         $postsArray = array();
  3.         $cnt=0;
  4.         while (have_posts() && $cnt<3) : the_post();
  5.                 $eventdate = get_post_meta($post->ID, 'eventdate', true);
  6.                 $todaysDate = time();
  7.                 if ( $todaysDate < $eventdate):
  8. $postsArray[] = '<li><a href="'.get_permalink().'" rel="related" title="'.get_the_title().'">'.get_the_title().'</a></li>';
  9. $cnt++;
  10.                 endif;
  11.         endwhile;
  12. if(!empty($postsArray)):
  13.         echo '<li class="widget-container">';
  14.         echo '<h3 class="widget-title">Upcoming Events</h3><ul>', implode("\n",$postsArray), '</ul>';
  15.         echo '</li>';
  16. endif;
  17. endif; ?>
clone this paste RAW Paste Data