Support » How-To and Troubleshooting » Listing Recent Posts

Listing Recent Posts

  • 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.


Viewing 1 replies (of 1 total)
  • 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.

Viewing 1 replies (of 1 total)
  • The topic ‘Listing Recent Posts’ is closed to new replies.