[resolved] Listing Latest Post Titles, Date Posted, and Category? (9 posts)

  1. The Dole
    Posted 7 years ago #

    Currently I'm creating a latest post area only displays the latest 10 posts' post title date along with its post titles and category. Currently I'm using the following code to load the latest 10 posts titles:
    <?php wp_get_archives('title_li=&amp;type=postbypost&amp;limit=10'); ?>
    Unfortunately this only loads the post titles and I need more than that. Note the latest posts area I'm making is relatively large under the content area, so don't think it's a little sidebar area.

    What code or plugin would I need to make it look like a similar structure like:

    1/5/09: Post Title 4 - Posted in: Category 4
    1/15/09: Post Title 3 - Posted in: Category 3
    1/9/09: Post Title 2 - Posted in: Category 2
    1/5/09: Post Title 1 - Posted in: Category 1

    Any help would be greatly appreciated! Thanks for reading and I hope to see some replies.

  2. Mark / t31os

    Posted 7 years ago #

    Something like...

        $postbits= new WP_Query();
        if($postbits->have_posts()) :
        while ($postbits->have_posts()) : $postbits->the_post(); 
        thetime();?>: <a href="<?php the_title_attribute(); ?>"><?php the_title();?></a> - Posted in: <?php the_category();
        endwhile; endif;

    You might want to adjust the time and category parts a bit though..


  3. The Dole
    Posted 7 years ago #

    Thanks a lot! But I seem to get this error:
    Fatal error: Call to undefined function thetime() in D:\xampp\htdocs\wp-content\themes\test\home.php on line 47
    I copied and pasted the exact code you provided and defined time with 'F j, Y' (Month Day, Year) and it still gives me that error. What am I doing wrong?

  4. kapiljain.in
    Posted 7 years ago #

    This is some typing mistake:

    use the_time() instead of thetime()

  5. The Dole
    Posted 7 years ago #

    Alright thanks again! I really appreciate the support! :)

  6. Mark / t31os

    Posted 7 years ago #

    RE: time .. Oops... Glad you got it sorted though... :)

  7. chetanz
    Posted 7 years ago #

    Try Latest Posts Titles Plugin

  8. Mark / t31os

    Posted 7 years ago #

    That won't help, that plugin is for querying one category at a time... not what the user is attempting to do here...

  9. Marventus
    Posted 6 years ago #

    Hello everyone. I know this thread has been inactive for quite some time, but I found it when I was looking for a way to display the titles of the last 5 posts under the title of my Blog (which is displayed as an image), but in only one line that would display them one at a time (sort of like what Mashable has going on).
    So far, I have accomplished this using Feedburner's Headline Animator, but the options are limited, and since it only works with .gif backgrounds, there's a considerable loss in image quality.
    Does anyone have any ideas how to accomplish this? Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic