WordPress.org

Support

Support » Plugins and Hacks » Hacks » [Resolved] Latest Post, No Category, Multiple loops

[Resolved] Latest Post, No Category, Multiple loops

  • Nate
    Member

    @kapitol

    I understand that I can have 2 loops in my blog with one calling a specific category at the top of the page which acts like the latest post.

    That’s not what I want.

    What I would prefer to happen is have the Latest Post(loop 1) get a style which is different from the other posts(loop 2) without calling a specific category. Once I make a new post it replaces the 2nd most recent post which then get’s pushed to the 2nd loop without being duplicated.

    Another way to explain it. Only the most recent post at the top of the page receives it’s own unique style without having to assign a specific category to it while making the post.

    Does anyone know of a script or plugin which can help me achieve this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael
    Forum Moderator

    @alchymyth

    no need for two lops, this can work with a conditional statement;

    try this kind of structure:

    $new = 'first';
     while( have_posts() ) : the_post(); //start the loop
    
    if( $new == 'first' && !is_paged() ) :
    $new = 'not-first';
    /*how to style the first post; html and all*/
    else:
    /*how to style all other posts; html and all*/
    endif;
    
    endwhile; //end of the loop
    Nate
    Member

    @kapitol

    Alchymyth

    Works flawlessly. Thank you ever so much. PM if you need a graphic artist for anything, free of course. <3

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Latest Post, No Category, Multiple loops’ is closed to new replies.