Ready to get started?Download WordPress


[resolved] title, author, date list (4 posts)

  1. fksr86
    Posted 7 years ago #

    Hi, i'm working on my home page right now.

    I'd like to put a list of the last five posts on the site.

    I've found a code on the wordpress codex called mini-loop. i've put it, but now i can't do a list with the author and the date.

    i want something like this:

    1. (post title) by (author) on (date)
    2. (post title) by (author) on (date)
    3. (post title) by (author) on (date)
    4. (post title) by (author) on (date)
    5. (post title) by (author) on (date)

  2. whooami
    Posted 7 years ago #

    <?php $posts_per_page = 5;
    if (have_posts()) : while (have_posts()) : the_post();
    the_title(); ?> by <?php the_author(); ?> on <?php the_time('F j, Y');?><br />
    <?php endwhile; else: ?>
    <?php endif; ?>

    You can also use query_posts if you dont want to use the posts_per_page variable.

  3. whooami
    Posted 7 years ago #

    oh, sorry! I didnt put that code inside an ordered list.. Im assuming you can figure that out.. :)

  4. fksr86
    Posted 7 years ago #

    ya, i got it!

    thanks a lot!

Topic Closed

This topic has been closed to new replies.

About this Topic