Advertisement
Guest User

Multiple Loops (DONE)

a guest
Oct 4th, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.36 KB | None | 0 0
  1. <?php
  2. $my_query = new WP_Query('posts_per_page=1000&orderby=date&order=ASC&cat='.$catymeta);
  3.   while ($my_query->have_posts()) : $my_query->the_post();
  4.   $do_not_duplicate = $post->ID; ?>
  5.   <?php ob_start(); the_title(); $showtitle = ob_get_clean(); (preg_match('#\bSeason (\d+)#', $showtitle, $matches)); ?>
  6.     <?php // this set's the amount of season ?>
  7.   <?php endwhile; ?>
  8.   <?php
  9.   $seasonAm = $matches[0];
  10.   //echo $seasonAm;
  11.   (preg_match('#\b (\d+)#', $seasonAm, $matches2));
  12.   //echo $matches2[0];
  13.   ?>
  14.   <div id="seasons">
  15.     <?php for ($i = 1; $i <= $matches2[0]; $i++) { ?>
  16.     <a href="#season<?php echo $i ?>">Season <?php echo $i ?></a>
  17.   <?php } ?>
  18.   </div>
  19.     <?php //echo "" . $matches[0] . "\n"; ?>
  20.     <?php for ($i = 1; $i <= $matches2[0]; $i++) { ?>
  21.     <a name="season<?php echo $i ?>" id="season<?php echo $i ?>"></a>
  22.     <p><strong>Season <?php echo $i ?></strong></p>
  23.     <ol>
  24.     <?php $my_query = new WP_Query( "posts_per_page=1000&orderby=date&order=ASC&cat=".$catymeta );
  25.    if ( $my_query->have_posts() ) {
  26.        while ( $my_query->have_posts() ) {
  27.            $my_query->the_post();
  28.            {
  29. ?>
  30.     <?php ob_start(); the_title(); $showtitle = ob_get_clean(); if (strpos($showtitle,'Season '.$i.' ') !== false) { ?>  
  31.     <li class="msg_head"><span><?php
  32.     if (strlen($showtitle) > 70) {
  33. $text = substr($showtitle,0,70);
  34. echo $text."..."; } else { echo $showtitle; } ?> </span><div class="dwnArr"></div> <a class="show-play2" href="<?php the_permalink(); ?>">watch now</a></li>
  35.     <div class="msg_body">
  36.     <table border="0" cellpadding="0" class="episode-descrip">
  37.     <tr>
  38.     <td valign="center">
  39.     <div class="swdescrip">
  40.     <h5><?php echo $showtitle; ?></h5>
  41.     <?php ob_start(); the_content(); $showcontent = ob_get_clean();
  42.     if (strlen($showcontent) > 200) {
  43.     $text2 = substr($showcontent,0,200);
  44.     echo $text2."..."; } else if (strlen($showcontent) < 0) { echo "<div style=\"margin:15px 0;float:left\">No description available.</div>"; }
  45.     else { echo $showcontent; }
  46.     ?> <?php if ( current_user_can('level_10') ) { ?><br /><br /><a href="http://watchberry.com/wp-admin/post.php?post=<?php the_ID(); ?>&action=edit" target="_blank">-- edit</a><?php } ?></div>
  47.     <a class="watchEpisode" href="<?php the_permalink(); ?>">Watch this Episode</a>
  48.     </td>
  49.     </tr>
  50.     </table>
  51.     </div>
  52.     <?php } ?>
  53.     <?php
  54.            }
  55.        }
  56.    }
  57.    wp_reset_postdata(); ?>
  58.     </ol>
  59.     <?php } ?>
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement