Advertisement
Digitalraindrops

Category Loop 2

May 30th, 2011
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <!-- FILE: page.php -->
  2. <?php get_header(); ?>
  3.  
  4. <div id class="content_container"> <?php get_sidebar (); ?>
  5.     <div id class="main_content">
  6.         <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
  7.         <h1><?php the_title(); ?></h1>
  8.         <?php
  9.            global $post;
  10.            $template_names = array();
  11.            $template_names[]='loop-' .$post->post_name .'.php';
  12.            $template_names[]='loop-page.php';
  13.            locate_template( $template_names, true, true );
  14.         ?>
  15.     </div>
  16. </div>
  17. <?php endwhile; ?>
  18.  
  19. <?php get_footer(); ?>
  20.  
  21. <!-- FILE: loop-portfolio.php -->
  22. <?php query_posts('category_name=portfolio&posts_per_page=3');?>
  23.     <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
  24.     <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  25.         <div class="post_title"><h1><?php the_title();?></h1></div>
  26.         <div id class="picbox"></div>
  27.         <p><?php the_content();?></p>
  28.     </div>
  29.     <div id class="clear"></div>
  30. <?php endwhile; ?>
  31. <?php rewind_posts(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement