Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have this archive page (using the Thesis theme, version 1.8.5):

http://testblog.squeesome.com/columns/

I'm trying to make the structure look like the Tumblr archives. I got so far as applying the jQuery Masonry effect, the image hover effect and making the month headers appear, but I can't wrap my head around how to group it by month, like the Tumblr archive page does it.

Here is the code I'm using in my custom_functions.php file:

// Archives page layout
function mason_script() {
    wp_enqueue_script( 'jquery-masonry' );
}
add_action( 'wp_enqueue_scripts', 'mason_script' );
function custom_archive() {
if (is_page(181))  {
?>
<div id="container2">
<?php
$blogtime = date('Y');
$prev_limit_year = $blogtime - 1;
$prev_month = '';
$prev_year = '';
$args = array(
         'posts_per_page' => 12,
         'ignore_sticky_posts' => 1
);
$postsbymonth = new WP_Query($args);
while($postsbymonth->have_posts()) {
    $postsbymonth->the_post();
    if(get_the_time('F') != $prev_month || get_the_time('Y') != $prev_year && get_the_time('Y') == $prev_limit_year) {
                   echo "<h1>".get_the_time('F Y')."</h1>\n\n";
        }
    ?>
<div class="brick">
<div class="brick_featured_image">
<span class="rollover" ><div class="brick_header"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></div></span><img src="<?php bloginfo('template_directory'); ?>/custom/scripts/timthumb.php?src=<?php echo catch_that_image(); ?>&w=240&zc=1&a=t" alt="<?php the_title(); ?>" width="240" />
</div>
</div>
                <?php // your other template tags ?>
    <?php
    $prev_month = get_the_time('F');
    $prev_year = get_the_time('Y');
}
        ?></div><!-- container -->
<?php } }

remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');
add_action('thesis_hook_custom_template', 'custom_archive');

My grasp of PHP is rudimentary at best, but I'm very eager to learn :)

If you could point me in the right direction it would be great!

share|improve this question
1  
Please post your code here please. A question should not depend on an external source –  s_ha_dum Jul 10 '13 at 1:55
    
Edited and added the code to my question. My apologies. –  squeesome Jul 10 '13 at 2:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.