• Resolved ohdiesel

    (@ohdiesel)


    Hello,

    Can someone tell me how I can show the first, second, third, fourth, fifth latest posts using get_posts?

    I have 5 columns on my page using the following code for each list item:

    <?php $feature_post = get_posts( ‘numberposts=2&order=ASC&orderby=title’ ); ?>

    Anyone have any idea how i can get the first column to display the latest post, while the 2nd column will have the 2nd latest, the third column to have the 3rd latest, until the 5th to have the 5th latest post, etc.

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • It might be better to tackle this using CSS rather than PHP. If you float each of your 5 post blocks left, they should automatically display in a 5 column grid on screens that are wide enough. On smaller screens, they should drop to a 4 column grid (or less) as needed. The only tricky part is fixing the height of each of the columns, so that they drop to 4 or less columns gracefully. Given that post content (and even post excerpts) can vary in length, this might take some fine tuning before you reach an acceptable figure for the height.

    Thread Starter ohdiesel

    (@ohdiesel)

    Hello,

    Ah, you are right about that, but I think that is far too difficult for me.

    There is no easy fix with get_post?

    Not really. get_posts() just defines which posts to display. It can’t define how they should be displayed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘GET_POSTS 1st 2nd 3rd post’ is closed to new replies.