Skip to content

Instantly share code, notes, and snippets.

@jtsternberg
Forked from gregrickaby/home.php
Created February 13, 2012 21:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jtsternberg/1820740 to your computer and use it in GitHub Desktop.
Save jtsternberg/1820740 to your computer and use it in GitHub Desktop.
Genesis Custom Loop w/ Featured Image
<?php
$odd_or_even = 'even';
$loop_2 = new WP_Query( 'cat=1&showposts=2&orderby=date&order=DESC' ); while ($loop_2->have_posts()) : $loop_2->the_post(); ?>
<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>
@gregrickaby
Copy link

THIS WORKED, THANKS! :D

@unix7
Copy link

unix7 commented Oct 24, 2012

So this will make the featured image left and right alternately too?
Great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment