WordPress.org

Ready to get started?Download WordPress

Forums

Query specific post by date or order posted (12 posts)

  1. tyleroakleaf
    Member
    Posted 7 years ago #

    Is there a way to display only the 2nd or 3rd most recent post? I'm designing a theme and want to make my posts display in a different manner then a typical single column (much like this site http://www.kineda.com/) My approach has been to try to separate my posts so I can position each one where I want it.

    Thanks for the help.

  2. Glenn Ansley
    Member
    Posted 7 years ago #

    Will they all be from the same category or will each column represent a different category?

  3. tyleroakleaf
    Member
    Posted 7 years ago #

    The same.

  4. Glenn Ansley
    Member
    Posted 7 years ago #

    I'm not sure if I understand you 100%. It sounds like it's just a css issue and not a programming issue. Is this correct? (The order that they're posting in now is fine, you just want them to look different on the page?)

  5. tyleroakleaf
    Member
    Posted 7 years ago #

    If you know of a css solution I'd love to hear it, but I want to call each post individually, and the only way I can think to do that is through php.

  6. Glenn Ansley
    Member
    Posted 7 years ago #

    I want to call each post individually

    What do you mean by this?
    Do you want the your posts updating in a loop or do you want to place individual posts that never change in a certain place on your webpage?

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    If you just want to position them differently, but still want to have them cycle through, change your Loop to put each post in its own DIV. Then you can position them through whatever CSS you like.

    Example:

    <?php
    ...
    $my_post_counter=0;
    // beginning of the Loop
    while (have_posts()) {
    the_post();
    $my_post_counter++;
    ?>
    <div id="post-<?php echo $my_post_counter; ?>">
    <?php
    // stuff to display post goes here
    ?>
    </div>
    <?php
    } // end of the Loop
    ...
    ?>

    See? So each post gets put into a div with an id of "post-X" where X is the number of the post on the page. Then you can arrange them around with CSS.

  8. tyleroakleaf
    Member
    Posted 7 years ago #

    That's what I was looking for! Thanks!

  9. neoent
    Member
    Posted 7 years ago #

    hi how would you arrange them with CSS taking the individual posts and resized them into the little "blocks" approximately 210px wide. But they show up within the "content" area of the home page in decending order from most recently posted

    4
    3
    2
    1

    like "tyleroakleaf" I would like to have it similar to the kineda site where its 2 posts per row in order of left to right.

    4 3
    2 1

    Any help would be greatful thank you.

  10. neoent
    Member
    Posted 7 years ago #

    sorry meant to say that I have resized them into little 210px wide boxes but they show as normal decending vertically 4,3,2,1.. so how would I get them to

    4 3
    2 1.
    thanks

  11. neoent
    Member
    Posted 7 years ago #

    Figured it out. Thanks used a used a gave the class "post" a fixed width and height and made it float:left; may not be the right way to get it done but its working.

  12. neoent
    Member
    Posted 7 years ago #

    Figured it out. Thanks in the css resized the class/style "post" with a fixed width and height and made it float:left; may not be the right way to get it done but its working. posts come out as
    4 3
    2 1

Topic Closed

This topic has been closed to new replies.

About this Topic