Advertisement
alchymyth

PageOfPosts

Jun 25th, 2011
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.68 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: PageOfPosts
  4. *
  5. * for Twenty Ten
  6. */
  7.  
  8.  
  9. get_header(); ?>
  10.  
  11.                 <div id="container">
  12.                         <div id="content" role="main">
  13.  
  14. <?php
  15.  
  16.   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  17.  
  18.   $do_not_show_stickies = 1; // 0 to show stickies
  19.   $args=array(
  20.     'category_name' => 'blog',
  21.     'orderby' => 'date',
  22.     'order' => 'DESC',
  23.     'paged' => $paged,
  24.     'caller_get_posts' => $do_not_show_stickies
  25.   );
  26. query_posts( $args ); ?>
  27.  
  28.  
  29. <?php /* Run the loop to output the posts. */ ?>
  30.  
  31. <?php /* Display navigation to next/previous pages when applicable */ ?>
  32.  
  33. <?php /* If there are no posts to display, such as an empty archive page */ ?>
  34. <?php if ( ! have_posts() ) : ?>
  35.     <div id="post-0" class="post error404 not-found">
  36.         <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
  37.         <div class="entry-content">
  38.             <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
  39.             <?php get_search_form(); ?>
  40.         </div><!-- .entry-content -->
  41.     </div><!-- #post-0 -->
  42. <?php endif; ?>
  43.  
  44. <?php /* Start the Loop; copied from loop.php; redundand sections removed. */ ?>
  45. <?php while ( have_posts() ) : the_post(); ?>
  46.  
  47.  
  48.         <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  49.             <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  50.  
  51.             <div class="entry-meta">
  52.                 <?php twentyten_posted_on(); ?>
  53.             </div><!-- .entry-meta -->
  54.  
  55.    
  56.             <div class="entry-content">
  57.                 <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
  58.                 <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
  59.             </div><!-- .entry-content -->
  60.    
  61.             <div class="entry-utility">
  62.                 <?php if ( count( get_the_category() ) ) : ?>
  63.                     <span class="cat-links">
  64.                         <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
  65.                     </span>
  66.                    
  67.                 <?php endif; ?>
  68.                 <?php
  69.                     $tags_list = get_the_tag_list( '', ', ' );
  70.                     if ( $tags_list ):
  71.                 ?>
  72.                     <span class="tag-links">
  73.                         <?php printf( __( '<span class="meta-sep">|</span> <span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
  74.                     </span>
  75.                    
  76.                 <?php endif; ?>
  77.                 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
  78.                 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
  79.             </div><!-- .entry-utility -->
  80.         </div><!-- #post-## -->
  81.  
  82.         <?php comments_template( '', true ); ?>
  83.  
  84. <?php endwhile; // End the loop. Whew. ?>
  85.  
  86. <?php /* Display navigation to next/previous pages when applicable */ ?>
  87. <?php if (  $wp_query->max_num_pages > 1 ) : ?>
  88.                 <div id="nav-below" class="navigation">
  89.                     <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
  90.                     <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
  91.                 </div><!-- #nav-below -->
  92. <?php endif; ?>
  93.  
  94.  
  95. <?php wp_reset_query(); ?>
  96.  
  97.                         </div><!-- #content -->
  98.                 </div><!-- #container -->
  99.  
  100. <?php get_sidebar(); ?>
  101. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement