Skip to content

Instantly share code, notes, and snippets.

@gregrickaby
Forked from jtsternberg/home.php
Created June 3, 2012 04:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregrickaby/2861804 to your computer and use it in GitHub Desktop.
Save gregrickaby/2861804 to your computer and use it in GitHub Desktop.
Genesis Custom Loop w/ Featured Image and Odd/Even support
<?php
$odd_or_even = 'even';
$args = array(
'cat' => 1,
'posts_per_page' => 2,
'order' => 'DESC'
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
$do_not_duplicate = $post->ID;
?>
<div <?php post_class( $odd_or_even ); ?>>
<?php $odd_or_even = ( 'odd' == $odd_or_even ) ? 'even' : 'odd'; ?>
<div class="column-5 left">
<a href="<?php the_permalink(); ?>" /><?php the_post_thumbnail( 'thumbnail', array( 'class' => 'featured-image' ) ); ?></a>
<a href="<?php the_permalink(); ?>" /><span class="read-more">Read More</span></a>
</div>
<div class="column-6 right">
<h1 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<div class="entry-content">
<?php the_excerpt(); ?>
</div>
</div>
</div>
<?php endwhile; wp_reset_query(); ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment