• Resolved subigya

    (@subigya)


    Scenario:
    I need to display the latest 4 posts excluding the most recent post which all have featured images (thumbnails).

    Lets say those 4 posts are 1,2,3 and 4.

    1 and 4 needs to load a long sized thumbnail => ‘home-long’
    2 and 3 needs to load a short sized thumnail => ‘home-short’

    This is what my current code looks like:

    <?php $recent = new WP_Query("cat=" .ot_option('hp_mid_cat'). "&showposts=" .ot_option('hp_mid_num') ); while($recent->have_posts()) : $recent->the_post();?>
    
                	<div class="homepagecontent">
    
                        <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail( 'home-long'); ?></a>
                        <h4><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h4>
                    	<?php the_excerpt(); ?>
    
                    </div>
    
                <?php endwhile; ?>

    What this does right now is loads all the posts including the most recent one, with the thumbmail size ‘home-long’.

    Anyone had to deal with this kind of a situation?

The topic ‘Alternating content (not class)’ is closed to new replies.