-
-
Save jamiemitchell/0b69e9d0e929e7b60e1f 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