• Mr. Grim Reaper

    (@mr-grim-reaper)


    Hey, so I’m designing a theme for WordPress (using version 2.5.1 as my testbed). What I want to do it separate the one most recent post from all those which proceed it. I know it it possible with CSS, but it isn’t as reliable. How can I control the output of the most recent post? I thought the get_posts() function might’ve worked, but no success. Need I go as far as to using a plugin?

Viewing 4 replies - 1 through 4 (of 4 total)
  • ivovic

    (@ivovic)

    in the loop, try checking if $posts[0] == $post

    Thread Starter Mr. Grim Reaper

    (@mr-grim-reaper)

    I don’t understand what you mean. Where would I use that? What would $post and $posts be?

    I have it this way for now:

    • $firstpost = get_posts( 'numberposts=1&post_date&order=DESC' );
    • foreach( $firstpost as $post ): setup_postdata( $post );

    That gives me my first, most recent post. Problem is, how do I get all but that one to display after?

    ivovic

    (@ivovic)

    ok, well if you’re comfortable doing it that way – you can use get_posts without the numberposts=1, and instead with offset=1 in it’s place.

    that’ll pull everything after the first post.

    Thread Starter Mr. Grim Reaper

    (@mr-grim-reaper)

    Sorry for the late reply, but I still can’t seem to get it to work right. The post titles come out all wrong, but the content works fine.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘First (most recent) post separate from the rest’ is closed to new replies.