Advertisement
ChapDaddy65

WP Multiple Loop homepage trouble

Mar 12th, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.40 KB | None | 0 0
  1. <?php /* Template Name: Home */ ?>
  2.  
  3. <?php get_header(); ?>
  4.  
  5.         <div id="container" class="col8">
  6.  
  7.             <div id="content">
  8.  
  9.             <?php
  10.             // 3 seperate Loops each containing its own category:
  11.  
  12.             // 1st Loop Category - Blog
  13.             // 2nd Loop Category - Project
  14.             // 3rd Loop Category - tutorial
  15.             ?>
  16.  
  17.             <?php //Blog Loop ?>
  18.             <?php $blog_loop = new WP_Query('category_name=blog&posts_per_page=1');
  19.  
  20.                 while ($blog_loop->have_posts()) : $blog_loop->the_post();
  21.  
  22.                     $do_not_duplicate = $post->ID;
  23.  
  24.             ?>
  25.  
  26.             <div id="blog-post-<?php the_ID(); ?>" <?php post_class(); ?>>
  27.  
  28.                 <div class="blog-entry-content">
  29.  
  30.                     <?php the_content(); ?>
  31.  
  32.                 </div><!-- .entry-content -->
  33.        
  34.             </div><!-- #post-<?php the_ID(); ?> -->
  35.  
  36.             <?php endwhile; ?>
  37.  
  38.  
  39.             <?php wp_reset_query() ?>
  40.  
  41.  
  42.             <?php //Project Loop ?>
  43.             <?php $project_loop = new WP_Query('category_name=project&posts_per_page=1');
  44.  
  45.                 while ($project_loop->have_posts()) : $project_loop->the_post();
  46.  
  47.                     $do_not_duplicate = $post->ID;
  48.  
  49.             ?>
  50.  
  51.             <div id="project-post-<?php the_ID(); ?>" <?php post_class(); ?>>
  52.  
  53.                 <div class="project-entry-content">
  54.  
  55.                     <?php the_content(); ?>
  56.  
  57.                 </div><!-- .entry-content -->
  58.        
  59.             </div><!-- #post-<?php the_ID(); ?> -->
  60.  
  61.             <?php endwhile; ?>
  62.  
  63.  
  64.             <?php wp_reset_query() ?>
  65.            
  66.  
  67.             <?php //Tutorials Loop ?>
  68.             <?php $tutorial_loop = new WP_Query('category_name=tutorial&posts_per_page=5');
  69.  
  70.                 while ($tutorial_loop->have_posts()) : $tutorial_loop->the_post();
  71.  
  72.                     $do_not_duplicate = $post->ID;
  73.  
  74.             ?>
  75.  
  76.             <div id="tutorial-post-<?php the_ID(); ?>" <?php post_class(); ?>>
  77.  
  78.                 <div class="tutorial-entry-content">
  79.  
  80.                     <?php the_content(); ?>
  81.  
  82.                 </div><!-- .entry-content -->
  83.        
  84.             </div><!-- #post-<?php the_ID(); ?> -->
  85.  
  86.             <?php endwhile; endif; ?>
  87.  
  88.             </div><!-- #content -->
  89.  
  90.         <?php get_sidebar(); ?>
  91.  
  92.         </div><!-- #container -->
  93.  
  94. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement