Listing Recent Posts (2 posts)

  1. FireFox
    Posted 10 years ago #

    Hello all

    I would like to list recent posts (within the same category) in my single.php page?

    for example, if I have a category called "Google", I would like to list the 5 recent/prior links to posts that I've written about "Google".

    I couldn't find the solution in codex. Anyone know the solution?

    I know there is a plug-in called "SameCat" that uses this tag:

    <?php echo list_posts_of_cat(get_the_category(), 5, 5); ?>

    but i'm still trying to get it to work properly though.


  2. tomhanna
    Posted 10 years ago #

    get_the_category only works within The Loop, so that may be your problem. If you want the list to be inside The Loop you can probably do it, but if you're trying for a list of recent posts in the sidebar, I don't see a way to manage it.

Topic Closed

This topic has been closed to new replies.

About this Topic