Advertisement
Kortschot

3 loops

May 31st, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.82 KB | None | 0 0
  1.  
  2. <?php get_header(); ?>
  3.  
  4. <section>
  5.     <article id="">
  6.         <?php query_posts('cat=1&posts_per_page=5');
  7.             if (have_posts()) : while (have_posts()) : the_post();
  8.                  the_title ();
  9.                  the_content();
  10.              endwhile; endif; ?>
  11.     </article>
  12. </section>
  13.  
  14. <section>
  15.     <div id="news">
  16.         <?php $list_news = new WP_Query('cat=3&showposts=-1'); ?>
  17.         <?php $count = 0; ?>
  18.         <?php while ($list_news->have_posts()) : $list_news->the_post(); $do_not_duplicate = $post->ID; ?>
  19.         <?php $count++; ?>
  20.         <?php if ($count == 1) : ?>
  21.        
  22.         <div class="col_one">
  23.             <article>
  24.             <h3><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h3>
  25.                 <?php the_content(); ?>
  26.             </article>
  27.         </div> <!-- col_one -->
  28.  
  29.         <?php elseif ($count == 2 || $count == 3 || $count == 4) : ?>
  30.    
  31.         <?php if ($count == 2) : ?>
  32.         <div class="col_two">
  33.         <?php endif; ?>
  34.  
  35.         <article>
  36.             <h3><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h3>
  37.             <?php the_content(); ?>
  38.         </article>
  39.            
  40.         <?php if ($count == 4 || ($list_news->current_post+1) == $list_news->post_count ) : ?>
  41.  
  42.         </div> <!-- col_two -->
  43.  
  44.         <?php endif; ?>
  45.          
  46.         <?php else : ?>
  47.  
  48.         <?php if ($count == 5) : ?>
  49.         <div class="col_three">
  50.         <?php endif; ?>
  51.  
  52.             <article>
  53.    
  54.                 <h3><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h3>
  55.    
  56.             </article>
  57.  
  58.         <?php if ( ($list_news->current_post+1) == $list_news->post_count ) : ?>
  59.         </div> <!-- col_three -->
  60.         <?php endif; ?>
  61.        
  62.         <?php endif; ?>
  63.         <?php endwhile; ?>
  64.  
  65.     </div> <!-- end news -->
  66. </section>
  67.  
  68. <section>
  69.  
  70.     <article id="">
  71.  
  72.         <?php query_posts('cat=4&posts_per_page=5');
  73.  
  74.             if (have_posts()) : while (have_posts()) : the_post();
  75.  
  76.                  the_title ();
  77.                  the_content();
  78.  
  79.              endwhile; endif; ?>
  80.  
  81.     </article>
  82.  
  83. </section>
  84.  
  85. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement