Advertisement
alchymyth

home

Mar 13th, 2013
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.             $do_not_duplicate = array(); ?>
  19.             <?php $blog_loop = new WP_Query('category_name=blog&posts_per_page=1');
  20.  
  21.                 while ($blog_loop->have_posts()) : $blog_loop->the_post();
  22.  
  23.                     $do_not_duplicate[] = $post->ID;
  24.  
  25.             ?>
  26.  
  27.             <div id="blog-post-<?php the_ID(); ?>" <?php post_class(); ?>>
  28.  
  29.                 <div class="blog-entry-content">
  30.  
  31.                     <?php the_content(); ?>
  32.  
  33.                 </div><!-- .entry-content -->
  34.        
  35.             </div><!-- #post-<?php the_ID(); ?> -->
  36.  
  37.             <?php endwhile; ?>
  38.  
  39.  
  40.             <?php wp_reset_postdata() ?>
  41.  
  42.  
  43.             <?php //Project Loop ?>
  44.             <?php $project_loop = new WP_Query(array( 'category_name' => 'project', 'posts_per_page' => 1, 'post__not_in' => $do_not_duplicate ));
  45.  
  46.                 while ($project_loop->have_posts()) : $project_loop->the_post();
  47.  
  48.                     $do_not_duplicate[] = $post->ID;
  49.  
  50.             ?>
  51.  
  52.             <div id="project-post-<?php the_ID(); ?>" <?php post_class(); ?>>
  53.  
  54.                 <div class="project-entry-content">
  55.  
  56.                     <?php the_content(); ?>
  57.  
  58.                 </div><!-- .entry-content -->
  59.        
  60.             </div><!-- #post-<?php the_ID(); ?> -->
  61.  
  62.             <?php endwhile; ?>
  63.  
  64.  
  65.             <?php wp_reset_postdata() ?>
  66.            
  67.  
  68.             <?php //Tutorials Loop ?>
  69.             <?php $tutorial_loop = new WP_Query(array( 'category_name' => 'tutorial', 'posts_per_page' => 5, 'post__not_in' => $do_not_duplicate )) ;
  70.  
  71.                 while ($tutorial_loop->have_posts()) : $tutorial_loop->the_post();
  72.  
  73.                     $do_not_duplicate[] = $post->ID;
  74.  
  75.             ?>
  76.  
  77.             <div id="tutorial-post-<?php the_ID(); ?>" <?php post_class(); ?>>
  78.  
  79.                 <div class="tutorial-entry-content">
  80.  
  81.                     <?php the_content(); ?>
  82.  
  83.                 </div><!-- .entry-content -->
  84.        
  85.             </div><!-- #post-<?php the_ID(); ?> -->
  86.  
  87.             <?php endwhile; ?>
  88.             <?php wp_reset_postdata() ?>
  89.  
  90.             </div><!-- #content -->
  91.  
  92.         <?php get_sidebar(); ?>
  93.  
  94.         </div><!-- #container -->
  95.  
  96. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement