Skip to content

Instantly share code, notes, and snippets.

@freezvd
Forked from jamiemitchell/front-page.php
Last active August 29, 2015 14:06
Show Gist options
  • Save freezvd/47a09912f7384802a53a to your computer and use it in GitHub Desktop.
Save freezvd/47a09912f7384802a53a to your computer and use it in GitHub Desktop.
<?php
//* Add markup for homepage portfolio
add_action( 'genesis_after_header', 'minimum_home_portfolio', 20 );
function minimum_home_portfolio() {
printf( '<div %s>', genesis_attr( 'home-portfolio' ) );
genesis_structural_wrap( 'home-portfolio' );
$args = array(
'post_type' => 'portfolio',
'order' => 'DESC',
'posts_per_page' => 4
);
$loop = new WP_Query( $args );
if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post();
do_action( 'genesis_before_entry' );
printf( '<article %s>', genesis_attr( 'entry' ) );
do_action( 'genesis_before_entry_content' );
printf( '<div %s>', genesis_attr( 'entry-content' ) );
if ( $image = genesis_get_image( 'format=url&size=portfolio' ) ) {
printf( '<div class="portfolio-image"><a href="%s" rel="bookmark"><img src="%s" alt="%s" /></a></div>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
}
echo '</div>'; //** end .entry-content
do_action( 'genesis_after_entry_content' );
echo '<h1 itemprop="headline" class="entry-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h1>';
echo '</article>';
do_action( 'genesis_after_entry' );
endwhile; endif; wp_reset_postdata();
genesis_structural_wrap( 'home-portfolio', 'close' );
echo '</div>'; //* end .home-portfolio
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment