Digitalraindrops

Simple Post List Alternate BG

Oct 13th, 2010
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.51 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The loop that displays just titles.
  4.  *
  5.  * @package WordPress
  6.  * @subpackage Twenty_Ten
  7.  * @since Twenty Ten 1.0
  8.  */
  9. ?>
  10.  
  11. <?php /* Display navigation to next/previous pages when applicable */ ?>
  12. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  13.         <?php /* add page navigation to indexes */ ?>
  14.         <?php if(function_exists('wp_pagenavi') ) : ?>
  15.             <?php wp_pagenavi(); ?>
  16.         <?php else: ?>
  17.         <div id="nav-above" class="navigation">
  18.             <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
  19.             <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
  20.         </div>
  21.         <?php endif; ?>
  22. <?php endif; ?>
  23.  
  24. <?php /* If there are no posts to display, such as an empty archive page */ ?>
  25. <?php if ( ! have_posts() ) : ?>
  26.     <div id="post-0" class="post error404 not-found">
  27.         <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
  28.         <div class="entry-content">
  29.             <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
  30.             <?php get_search_form(); ?>
  31.         </div><!-- .entry-content -->
  32.     </div><!-- #post-0 -->
  33. <?php endif; ?>
  34.  
  35. <?php /* Start the Loop inside the list box. */ ?>
  36.  
  37. <div class="list-box">
  38. <?php while ( have_posts() ) : the_post(); ?>
  39.  
  40. <?php $counter++; $style=""; ?>
  41.  
  42. <?php if($counter % 2) $style='style="background-color: #f5f5f5";'; ?>
  43. <?php /* Display post list of titles */ ?>
  44.  
  45.         <div id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php echo $style; ?> >
  46.             <h2 class="list-title">
  47.                 <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>
  48.         </div><!-- #post-## -->
  49.  
  50. <?php endwhile; // End the loop. Whew. ?>
  51.  
  52. </div>
  53.  
  54. <?php /* Display navigation to next/previous pages when applicable */ ?>
  55. <?php if (  $wp_query->max_num_pages > 1 ) : ?>
  56.         <?php /* add page navigation to indexes */ ?>
  57.         <?php if(function_exists('wp_pagenavi') ) : ?>
  58.             <?php wp_pagenavi(); ?>
  59.         <?php else: ?>
  60.                 <div id="nav-below" class="navigation">
  61.                     <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
  62.                     <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
  63.                 </div><!-- #nav-below -->
  64.         <?php endif; ?>
  65. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment