Advertisement
Guest User

WordPress Advanced Multiple Loop - Loops multiplos

a guest
Aug 26th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.23 KB | None | 0 0
  1. <div class="content-multipleloop">
  2. <?php if ( have_posts() ) : ?>
  3. <?php $temp_count=''; ?>
  4. <?php while ( have_posts() ) : the_post(); ?>
  5. <?php
  6.  
  7. // first post
  8. $post_count = $wp_query->current_post+1;
  9. if($post_count == 1){
  10.    
  11.     echo '<div class="row">
  12. <div><div class="first-post"><div class="col-sm-6 col-md-4"><h1>1' ;
  13.     echo ''.the_title();'';
  14.     echo '</h1></div>';
  15. }
  16. if($post_count == 2 || $post_count == 3 || $post_count == 4 || $post_count == 5 || $post_count == 6 || $post_count == 7 || $post_count == 8 || $post_count == 9 || $post_count == 10){
  17.   $temp_count = $post_count;
  18.   // close the last column and start a new one
  19.  
  20.   echo '</div><!-- closing '.$post_count.' -->';
  21.     echo '<div id="column-'.$post_count.'">';
  22. }
  23. ?>
  24.  
  25. <?php if($temp_count == 2) : ?>
  26. <div class="col-sm-6 col-md-4">
  27. <h2>2 - <?php the_title(); ?></h2>
  28. </div>
  29. <?php endif; ?>
  30.  
  31. <?php if($temp_count == 3) : ?>
  32. <div class="col-sm-6 col-md-4">
  33. <h3>3 - <?php the_title(); ?></h3>
  34. </div>
  35.  
  36.  
  37. <?php endif; ?>
  38.  
  39. <?php if($temp_count == 4) : ?>
  40. <div class="col-sm-6">
  41. <h4>4 - <?php the_title(); ?></h4>
  42. </div>
  43. <?php endif; ?>
  44.  
  45. <?php if($temp_count == 5) : ?>
  46. <div class="col-sm-6">
  47. <h4>5 - <?php the_title(); ?></h4>
  48. </div>
  49. <?php endif; ?>
  50.  
  51. <?php if($temp_count == 6) : ?>
  52. <div class="col-sm-6 col-md-12">
  53. <h1>6 - <?php the_title(); ?></h1>
  54. </div>
  55. <?php endif; ?>
  56.  
  57. <?php if($temp_count == 7) : ?>
  58. <div class="col-sm-6 col-md-12">
  59. <h2>7 - <?php the_title(); ?></h2>
  60. </div>
  61. <?php endif; ?>
  62.  
  63. <?php if($temp_count == 8) : ?>
  64. <div class="col-sm-6 col-md-12">
  65. <h3>8 - <?php the_title(); ?></h3>
  66. </div>
  67. <?php endif; ?>
  68.  
  69. <?php if($temp_count == 9) : ?>
  70. <div class="col-sm-6 col-md-12">
  71. <h4>9 - <?php the_title(); ?></h4>
  72. </div>
  73. <?php endif; ?>
  74.  
  75. <?php if($temp_count == 10) : ?>
  76. <div class="col-sm-6 col-md-12">
  77. <h4>10 - <?php the_title(); ?></h4>
  78. </div>
  79. <?php endif; ?>
  80.  
  81. <?php
  82. if($post_count == $wp_query->post_count){
  83.   // close the last column on the page
  84.     echo '</div> <!--END ROW--></div> <!--END ROW--><div class="clear"></div>
  85.     </div><!-- closing last column-->';
  86. }
  87. ?>
  88. <?php endwhile; ?>
  89. <?php if ($wp_query->max_num_pages > 1) oriont_pagenavi(); ?>
  90. <?php else : ?>
  91. <h1 class="entry-title">Nothing Found</h1>
  92. <?php endif; ?>
  93. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement