Created
January 23, 2015 18:50
-
-
Save Magnacarter/544430042ec7896cb2b6 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* Remove the Genesis custom loop and add custom template | |
* | |
* Added a counter to my WordPress loop to avoid having to use the Genesis Grid Loop | |
* | |
* @action genesis_loop | |
* | |
* @return void | |
*/ | |
function rjs_portfolio_loop() { | |
$args = array( | |
'post_type' => 'portfolio', | |
); | |
$portfolio = new WP_Query( $args ); | |
if ( $portfolio->have_posts() ) : | |
?> | |
<div class="projects"> | |
<?php $i = 0 ?> | |
<?php while ( $portfolio->have_posts() ) : $portfolio->the_post(); $i++ ?> | |
<div class="project one-half<?php echo ( 0 !== $i % 2 ) ? ' first' : null ?>"> | |
<div class="project_image"> | |
<img src="<?php the_field('project_image') ?>" height="400" width="400" /> | |
</div> | |
</div> | |
<?php endwhile; ?> | |
</div> | |
<?php | |
endif; | |
wp_reset_postdata(); | |
} | |
remove_action('genesis_loop', 'genesis_do_loop'); | |
add_action('genesis_loop', 'rjs_portfolio_loop'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment