Grow your CSS skills. Land your dream job.

A doubt in WordPress

  • # July 14, 2010 at 10:12 pm

    Hi guys, please help me!

    I want to do an post list of the latest posted in my blog, but i want to show the first item of the list with an thumbnail, and the other with no thumbs. How can i do this? The code to generate the thumb i use the thinthumb and it function well, but i dont know how can i configure the loop to show the thumbnail, title and content resume, only in the first post of the list and in the others only title and content resume.

    Can you help me please?

    Many Thanks,

    Ferraz from Brazil :mrgreen: !!!

    # August 4, 2010 at 1:48 am

    You need the fabled Mullet Loop. Jeff Starr has a great post about it at Perishable Press: http://perishablepress.com/press/2007/11/14/easily-adaptable-wordpress-loop-templates/

    Code:
    <?php if (have_posts()) : ?>
    <?php $count = 0; ?>

    // if there are posts to display, set the count to zero and begin the loop
    // if there are posts to display, process any code included here only once
    // display any code output from this region above the entire set of posts

    <?php while (have_posts()) : the_post(); ?>
    <?php $count++; ?>

    // for each post, increase the count variable by one and process any code included here
    // the output of any code included here will be displayed above the content of every post

    <?php if ($count == 1) : ?>

    // if this is the first post, process any code that is specified in this region
    // process any code specified in this region before the content of the first post

    <?php the_content(); ?> // display the full content of the first post only [b]This is where you’d add the shortcode or whatever to get the thumbnail to display...[/b]

    // process any code specified in this region after the content of the first post

    <?php else : ?>

    // if this is not the first post, process any code specified in this region
    // process any code specified in this region before the content of each post

    <?php the_excerpt(); ?> // display only the excerpt for all other posts

    // for all posts except the first, process this code below each post

    <?php endif; ?>

    // for each post, including the first, process any code included here
    // any code output will be displayed below the content of every post

    <?php endwhile; ?>

    // stop the post loop and process any code included here only once
    // any code output will be displayed below the entire set of posts

    <?php else : ?>

    // if there are no posts to display, process any code that is included here
    // the output of any code included here will be displayed instead of posts

    <?php endif; ?>

    # October 13, 2010 at 11:55 am

    Thank you man!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".