Advertisement
Zeaks

Portfolio Loop

Nov 6th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.59 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The loop to show posts in columns
  4.  * loop-grid.php
  5.  * Grid style page template with Nivo Slider
  6.  */
  7. ?>
  8.  
  9. <?php /* Start the Loop */ ?>
  10.  
  11. <?php $num_cols = 4; // set the number of columns here
  12.  
  13. for ( $i=1 ; $i <= $num_cols; $i++ ) :
  14.     echo '<div class="column col-' . $i . '" >';
  15.     $counter = $num_cols + 1 - $i; ?>
  16.  
  17. <?php while (have_posts()) : the_post();
  18.     if( $counter%$num_cols == 0 ) :
  19.  
  20. // begin of core posts output ?>
  21.  
  22.     <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  23.         <header class="entry-header">
  24.             <h1 class="entry-title">
  25.                 <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
  26.             </h1>
  27.         </header><!-- .entry-header -->
  28.  
  29.         <div class="portfolio-thumb">
  30.             <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyetwelve' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail('portfolio-thumbnail', 'class=alignleft'); ?></a>
  31.         </div>
  32.  
  33.         <div class="entry-summary">
  34.             <?php echo get_the_portfolio_excerpt(); ?>
  35.         </div><!-- .entry-summary -->
  36.     </article><!-- #post -->
  37.  
  38.     <?php //end of posts output
  39.  
  40.     endif; $counter++;
  41.         endwhile;
  42.             rewind_posts();
  43.         echo '</div>'; //closes the column div
  44.     endfor; ?>
  45.  
  46.     <?php /* Display navigation or wp-PageNavi if installed */ ?>
  47.         <?php if (  $wp_query->max_num_pages > 1 || get_query_var('page')) : ?>
  48.             <?php twentytwelve_content_nav( 'nav-below' ); ?>          
  49.         <?php endif;
  50.         wp_reset_query(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement