gordonek
gordonek

Reputation: 137

Multiple post views on homepage

I would like to set different post views on the homepage (also archive and category pages). For example to have first post with full width thumbnail and excerpt, next 2 posts with small thumbs and no excerpt and 4th post with just a title. Then again full width thumb, etc.

I've started with sth like this:

<?php if (have_posts()) : $post = $posts[0]; $c=0; while (have_posts()) : the_post();

$c++;
if( !$paged && $c == 1) :
the_title();
the_post_thumbnail( 'big-thumb' );        
the_excerpt(); 

elseif( !$paged && $c == 2 || $c == 3) :
the_title();
the_post_thumbnail( 'small-thumb' );   

elseif( !$paged && $c == 4) :
the_title();
...

How can make all this repeatable after the 4th post is shown? Or maybe there is a plugin for this kind of templates?

Upvotes: 1

Views: 45

Answers (1)

sandip patil
sandip patil

Reputation: 658

reset your $c if it reaches to 4

for e.g.

elseif( !$paged && $c == 4) {
the_title();
$c=0
}

Upvotes: 1

Related Questions