WordPress.org

Ready to get started?Download WordPress

Forums

1 recent post in each category box on the home.php (2 posts)

  1. leksa
    Member
    Posted 6 years ago #

    Hi,.
    I have problem in post order by date on this trick.
    I try some codes i have found here :

    <?php $mycats = array(28,30,31,102); // the category ID numbers
    foreach ($mycats as $catid) :
    query_posts(array('cat'=>$catid,'showposts'=>1));
    while (have_posts()): the_post();
    ?>
    //Do stuff
    <?php endwhile; ?><?php endforeach; ?>

    This way will pull 1 post for each category. First Category in array will show on the top of the page.

    But i have other idea to make its show ordered by date. The recent post could be show on the top. So, its will make the category box rotate dynamically depend on the updated post.

    Is it possible? I have try several looping tricks to do this.

    Thank You for all your idea.

  2. leksa
    Member
    Posted 6 years ago #

    any one here could help me?

Topic Closed

This topic has been closed to new replies.

About this Topic