Support » Themes and Templates » Listing Latest Post Titles, Date Posted, and Category?

  • Resolved The Dole

    (@the-dole)


    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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Something like…

    <?php
        $postbits= new WP_Query();
        $postbits->query('showposts=5');
        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..

    http://codex.wordpress.org/Template_Tags/the_time
    http://codex.wordpress.org/Template_Tags/the_category

    The Dole

    (@the-dole)

    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?

    kapiljain.in

    (@kapiljainin)

    This is some typing mistake:

    use the_time() instead of thetime()

    The Dole

    (@the-dole)

    Alright thanks again! I really appreciate the support! 🙂

    RE: time .. Oops… Glad you got it sorted though… 🙂

    Try Latest Posts Titles Plugin

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

    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!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Listing Latest Post Titles, Date Posted, and Category?’ is closed to new replies.