Advertisement
Guest User

ernestg loop-grid.php

a guest
Jun 20th, 2011
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.38 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The loop to show posts in columns
  4.  *
  5.  * loop-grid.php
  6.  
  7.  * @package WordPress
  8.  * @subpackage Twenty Ten
  9.  * @since 3.0.0
  10.  */
  11. ?>
  12.  
  13. <?php /* Display navigation to next/previous pages when applicable */ ?>
  14. <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  15.         <div id="nav-above" class="navigation">
  16.                 <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
  17.                 <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
  18.         </div><!-- #nav-above -->
  19. <?php endif; ?>
  20.  
  21. <?php /* If there are no posts to display, such as an empty archive page */ ?>
  22. <?php if ( ! have_posts() ) : ?>
  23.         <div id="post-0" class="post error404 not-found">
  24.                 <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
  25.                 <div class="entry-content">
  26.                         <p><?php _e( 'Apologies, but no results were found for the requested Archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
  27.                         <?php get_search_form(); ?>
  28.                 </div><!-- .entry-content -->
  29.         </div><!-- #post-0 -->
  30. <?php endif; ?>
  31.  
  32. <?php /* Start the Loop */ ?>
  33.  
  34.  
  35. <?php $num_cols = 4; // set the number of columns here
  36.  
  37. for ( $i=1 ; $i <= $num_cols; $i++ ) :
  38. echo '<div id="col-' . $i . '" class="col" >';
  39. $counter = $num_cols + 1 - $i; ?>
  40.  
  41. <?php while (have_posts()) : the_post();
  42. if( $counter%$num_cols == 0 ) :
  43. // begin of core posts output ?>
  44.  
  45.  
  46.                 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  47.                         <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>
  48.                        
  49.                         <div class="entry-meta">
  50.                                 <?php
  51.                                         printf( __( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', 'twentyten' ),
  52.                                                 get_permalink(),
  53.                                                 esc_attr( get_the_time() ),
  54.                                                 get_the_date(),
  55.                                                 get_author_posts_url( get_the_author_meta( 'ID' ) ),
  56.                                                 sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
  57.                                                 get_the_author()
  58.                                         );
  59.                                 ?><span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
  60.                         </div><!-- .entry-meta -->
  61.  
  62.                         <div class="entry-summary">
  63.                                 <?php the_excerpt(); ?>
  64.                         </div><!-- .entry-summary -->
  65.                        
  66.                         <div class="entry-utility">
  67. <?php the_post_thumbnail(); ?>
  68.                                 <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyten' ); ?></span><?php the_category( ', ' ); ?></span>
  69.                                 <span class="meta-sep"> | </span>
  70.                                 <?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __( 'Tagged ', 'twentyten' ) . '</span>', ', ', '<span class="meta-sep"> | </span>' ); ?>
  71.                                 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
  72.                                 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  73.                         </div><!-- #entry-utility -->
  74.                 </div><!-- #post-<?php the_ID(); ?> -->
  75.                 <?php // global $withcomments; $withcomments = 1;
  76.                 //comments_template( '', true ); ?>
  77.  
  78. <?php //end of posts output
  79.  
  80. endif; $counter++;
  81. endwhile;
  82. rewind_posts();
  83. echo '</div>'; //closes the column div
  84. endfor; ?>
  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.                                 <?php if(function_exists('page_navi')) { page_navi(); } else { ?>
  90.                                         <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
  91.                                         <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
  92.                                         <?php } ?>
  93.                                 </div><!-- #nav-below -->
  94. <?php endif;
  95.  wp_reset_query(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement