Advertisement
alchymyth

PoP

Jun 24th, 2011
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.82 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: PageOfPosts
  4. */
  5.  
  6. get_header(); ?>
  7.  
  8. <div id="content" class="narrowcolumn">
  9.  
  10. <?php
  11.  
  12.   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  13.  
  14.   $do_not_show_stickies = 1; // 0 to show stickies
  15.   $args=array(
  16.     'category_name' => 'blog',
  17.     'orderby' => 'date',
  18.     'order' => 'DESC',
  19.     'paged' => $paged,
  20.     'caller_get_posts' => $do_not_show_stickies
  21.   );
  22.   $temp = $wp_query;  // assign orginal query to temp variable for later use  
  23.   $wp_query = null;
  24.   $wp_query = new WP_Query($args);
  25.   if( have_posts() ) :
  26.         while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
  27.         <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
  28.         <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  29.         <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
  30.         <div class="entry">
  31.           <?php the_content('Read the rest of this entry »'); ?>
  32.         </div>
  33.         <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
  34.       </div>
  35.     <?php endwhile; ?>
  36.     <div class="navigation">
  37.       <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
  38.       <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
  39.     </div>
  40.   <?php else : ?>
  41.  
  42.         <h2 class="center">Not Found</h2>
  43.         <p class="center">Sorry, but you are looking for something that isn't here.</p>
  44.         <?php get_search_form(); ?>
  45.  
  46.     <?php endif;
  47.    
  48.     $wp_query = $temp;  //reset back to original query
  49.    
  50. ?>
  51.  
  52.     </div>
  53.  
  54. <?php get_sidebar(); ?>
  55.  
  56. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement