Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
Forked from billerickson/template-portfolio.php
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jamiemitchell/0b69e9d0e929e7b60e1f to your computer and use it in GitHub Desktop.
Save jamiemitchell/0b69e9d0e929e7b60e1f to your computer and use it in GitHub Desktop.
<?php
/* Template Name: Portfolio */
/**
* Portfolio Listing
*
*/
function be_portfolio_listing() {
$args = array(
'post_type' => 'portfolio',
'posts_per_page' => -1,
);
$loop = new WP_Query( $args );
if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post();
$class = 0 == $loop->current_post || 0 == $loop->current_post % 2 ? 'one-half first' : 'one-half';
echo '<div class="' . $class . '"><a href="' . get_permalink() . '">' . get_the_post_thumbnail( get_the_ID(), 'thumbnail' ) . '</a></div>';
endwhile; endif; wp_reset_postdata();
}
add_action( 'genesis_after_loop', 'be_portfolio_listing' );
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment