Skip to main content
2 of 8
details
markratledge
  • 8.7k
  • 6
  • 40
  • 62

Emulate the Thesis Theme content-excerpt grid loop

How does one go about emulating the Thesis Theme loop? I've tried extracting and adapting the functions from the theme itself, but with no luck.

What I want to do that Thesis does: on index.php, the loop shows a selectable number of full posts using the_content and then below that shows a selectable number of excerpts (using the_excerpt) in a grid pattern 2 excerpts wide. Any paged page of posts only uses the grid display of excerpts. Like this:

enter image description here

Full posts are no problem to figure out. And an example excerpt grid that works is below; it works by alternating the class of divs around each post to float them right and left, like this:

<?php

    if (have_posts()) :
    $odd = false;
    while (have_posts()) : the_post();
    $odd = !$odd;
    ?>

<div class="<?php if ($odd) echo 'uneven '; ?>gridpost">

<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>

<?php the_excerpt(); ?> 

</div>
    
    <?php endwhile; ?>
    
    <?php else : ?>
    
    <?php endif; ?>

And the CSS:

.uneven { float: left; clear: both; padding-left:10px; }

.gridpost { width: 235px; float: right; padding: 10px 10px 15px 5px; border-top: 1px solid #BBB; }

In my ideal loop, any paged page will only use the excerpt grid, but must be passed the correct post number and offset to display correctly.

There are code snips out there that come close to emulating it, but none seem to do the whole job, and offer paging, too. I can't run new WP_Querys with offsets because they won't "paged" (AFAIK).

Any ideas?

This loop would be ideal if it handled text and excerpts and content rather than images: http://www.billerickson.net/a-better-and-easier-grid-loop/

markratledge
  • 8.7k
  • 6
  • 40
  • 62