• Is there a way to display the last say .. 5 posts or so in a specific category? I wish to have a menu titled ‘Recent Articles’ πŸ™‚
    I think you get the idea. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You know, it’s interesting — I couldn’t find that myself. You can get the latest overall posts with:
    <?php get_archives(‘postbypost’, 5); ?>
    But, get_archives doesn’t have an optional Category (or Categories-list) argument. That wouldn’t be too hard to add to the sql-query. The posbypost query actually does:
    AND post_category > 0
    .. which would be pretty easy to change to
    AND post_category = $justShowCategoryID
    or something like that. But, you’d really want to have it be a separated query, maybe called ‘postbycat’, and if you ask for postbycat and don’t supply a catID, it’d drop to just returning postbypost instead. Hmmm… sounds like time for a CHAITHACK! πŸ™‚
    =d

    Okay, I broke down and did it. πŸ˜‰
    If you check http://www.chait.net, and go to any category page, the ‘latest posts’ list is followed by ‘latest in [category]’ list. I made minor changes to b2template.functions.php to pass in $cat and check it, allow for ‘postbycat’ and do the right things, and the new query testing $cat. You can grab it from the b2-includes subpath on the site if you want to look at it… It literally took under 10 minutes to do.
    =d

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Articles’ is closed to new replies.