Forked from jamiemitchell/template-portfolio.php
Last active
August 29, 2015 14:06
-
-
Save freezvd/1a422fce9fcccce8ab0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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