Advertisement
Guest User

4 multiple loops

a guest
Nov 3rd, 2012
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.60 KB | None | 0 0
  1. <div id="container" class="clearfix isotope">
  2. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  3.  
  4.    
  5.         <?php $my_query = new WP_Query('cat=3');?>
  6.        
  7.         <div class="element category-heading no-img y8" data-sort-brand="BRAND">
  8.                          
  9.                 <img src="<?php bloginfo('template_url'); ?>/img/tp.png" />
  10.  
  11.                 <span class="centered">
  12.                     <h2>Brand</h2>
  13.                 </span>
  14.              
  15.         </div>
  16.        
  17.         <?php while ($my_query->have_posts()) : $my_query->the_post();
  18.         $do_not_duplicate = $post->ID; ?>
  19.        
  20.                 <div class="element isotape-valueitem" data-sort-brand="BRAND:<?php the_time('YmdHi') ?>">
  21.                
  22.                     <div class="details y7a">
  23.                         <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><h2><?php the_title(); ?></h2></a>
  24.                     </div>
  25.                    
  26.                     <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
  27.                         <?php // If a featured image is specified display it otherwise display default transparent image
  28.                             $url = get_template_directory_uri();
  29.                             if(has_post_thumbnail()) {
  30.                                 the_post_thumbnail();
  31.                             } else {
  32.                                 echo '<img src="' . $url . '/img/tp.png" />';
  33.                             }
  34.                          ?>
  35.                     </a>
  36.                 </div>
  37.                        
  38.         <?php endwhile; ?>
  39.        
  40.         <?php $print_query = new WP_Query('cat=5');?>
  41.        
  42.         <div class="element category-heading no-img y8" data-sort-print="PRINT">
  43.          
  44.             <img src="<?php bloginfo('template_url'); ?>/img/tp.png" />
  45.            
  46.             <span class="centered">
  47.                 <h2>Print</h2>
  48.             </span>
  49.          
  50.         </div>
  51.        
  52.        
  53.         <?php while ($print_query->have_posts()) : $print_query->the_post();
  54.         $do_not_duplicate = $post->ID; ?>
  55.                                
  56.                 <div class="element isotape-valueitem" data-sort-print="PRINT:<?php the_time('YmdHi') ?>">
  57.                
  58.                     <div class="details y7a">
  59.                         <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><h2><?php the_title(); ?></h2></a>
  60.                     </div>
  61.                    
  62.                     <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
  63.                         <?php // If a featured image is specified display it otherwise display default transparent image
  64.                             $url = get_template_directory_uri();
  65.                             if(has_post_thumbnail()) {
  66.                                 the_post_thumbnail();
  67.                             } else {
  68.                                 echo '<img src="' . $url . '/img/tp.png" />';
  69.                             }
  70.                          ?>
  71.                     </a>
  72.                 </div>
  73.                        
  74.         <?php endwhile; ?>
  75.        
  76.         <?php $digital_query = new WP_Query('cat=4');?>
  77.        
  78.         <div class="element category-heading no-img y8" data-sort-digital="DIGITAL">
  79.        
  80.                 <img src="<?php bloginfo('template_url'); ?>/img/tp.png" />
  81.            
  82.                 <span class="centered">
  83.                     <h2>Digital</h2>
  84.                 </span>
  85.              
  86.             </div>
  87.        
  88.         <?php while ($digital_query->have_posts()) : $digital_query->the_post();
  89.         $do_not_duplicate = $post->ID; ?>
  90.                
  91.                 <div class="element isotape-valueitem" data-sort-digital="DIGITAL:<?php the_time('YmdHi') ?>">
  92.                
  93.                     <div class="details y7a">
  94.                         <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><h2><?php the_title(); ?></h2></a>
  95.                     </div>
  96.                    
  97.                     <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
  98.                         <?php // If a featured image is specified display it otherwise display default transparent image
  99.                             $url = get_template_directory_uri();
  100.                             if(has_post_thumbnail()) {
  101.                                 the_post_thumbnail();
  102.                             } else {
  103.                                 echo '<img src="' . $url . '/img/tp.png" />';
  104.                             }
  105.                          ?>
  106.                     </a>
  107.                 </div>
  108.                        
  109.         <?php endwhile; ?>
  110.        
  111.        
  112.         <?php $film_query = new WP_Query('cat=12');?>
  113.        
  114.         <div class="element category-heading no-img y8" data-sort-film="FILM">
  115.        
  116.                 <img src="<?php bloginfo('template_url'); ?>/img/tp.png" />
  117.            
  118.                 <span class="centered">
  119.                     <h2>Film</h2>
  120.                 </span>
  121.              
  122.             </div>
  123.        
  124.         <?php while ($film_query->have_posts()) : $film_query->the_post();
  125.         $do_not_duplicate = $post->ID; ?>
  126.                
  127.                 <div class="element isotape-valueitem" data-sort-film="FILM:<?php the_time('YmdHi') ?>">
  128.                    
  129.                     <div class="details y7a">
  130.                         <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><h2><?php the_title(); ?></h2></a>
  131.                     </div>
  132.                    
  133.                     <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
  134.                         <?php // If a featured image is specified display it otherwise display default transparent image
  135.                             $url = get_template_directory_uri();
  136.                             if(has_post_thumbnail()) {
  137.                                 the_post_thumbnail();
  138.                             } else {
  139.                                 echo '<img src="' . $url . '/img/tp.png" />';
  140.                             }
  141.                          ?>
  142.                     </a>
  143.                 </div>
  144.                        
  145.         <?php endwhile; ?>
  146.        
  147. <?php endwhile; else: ?>
  148. <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
  149. <?php endif; ?>
  150. </div> <!-- /container -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement