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

Multiple Loop in WordPress

By: a guest on Nov 12th, 2012  |  syntax: PHP  |  size: 0.49 KB  |  views: 98  |  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. $schedule= new WP_Query( array( 'post_type' => 'schedule' ) );
  2. if( $schedule->have_posts() ) {
  3.         while ($schedule->have_posts()) {
  4.                 $schedule->the_post();
  5.                 the_title( '<h1>', '</h1>' );
  6.                 $temp_post = $post;
  7.                 $workshops = new WP_Query( array('post_type' => 'workshop') );
  8.         if( $workshop->have_posts() ) {
  9.                 echo '<ul>';
  10.                         while($workshops->have_posts()) {
  11.                                 $workshops->the_post();
  12.                                 the_title( '<li>', '</li>' );
  13.                         }
  14.                         echo '</ul>';
  15.                 }
  16.                 $post = $temp_post;
  17.         }
  18. }
clone this paste RAW Paste Data