Skip to content

Instantly share code, notes, and snippets.

@Magnacarter
Last active August 29, 2015 14:14
Show Gist options
  • Save Magnacarter/71d33b14952008d84e98 to your computer and use it in GitHub Desktop.
Save Magnacarter/71d33b14952008d84e98 to your computer and use it in GitHub Desktop.
<?php
/**
* Template Name: Home
*/
/**
* Remove the Genesis custom loop and add custom template
*
* @action genesis_loop
*
* @return void
*/
function rjs_portfolio_loop() {
$args = array(
'post_type' => 'portfolio',
);
$portfolio = new WP_Query( $args );
?>
<div class="projects">
<?php if ( $portfolio->have_posts() ) : ?>
<?php while ( $portfolio->have_posts() ) : $portfolio->the_post() ?>
<div class="project one-half">
<div class="project-image one-half">
<img src="<?php echo esc_url( get_the_field( 'project_image' ) ) ?>" height="600" width="600" />
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php
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