WordPress.org

Ready to get started?Download WordPress

Forums

Feature Request: Implementation of 'category' a (2 posts)

  1. iioshius
    Member
    Posted 10 years ago #

    get_posts() is an extremely handy function, but the 'category' argument hasn't been implemented yet, which does tend to limit some if its usefulness.
    I'm implementing a linklog for my website, with entries that are really full blog posts (syndicated, comments, archived, etc - similar to the setup on photomatt.net). However, I want my links, while remaining part of my blog, to be displayed separately from the rest of my blog entries. They're all posted under a "linklog" category, so displaying only the linklog entries would be trivial were the 'category' attribute to get_posts() implemented.
    The next problem is displaying my "recent posts" list and main blog sans linklog entries. Probably the easiest way to do this would be to tell get_posts() to pull data from all categories except the linklog category. Unfortunately, get_posts() doesn't have this functionality.
    So, should WP be able to do this? I think so, and I've hacked up a modified version of get_posts() that has these two features. I'm still new to PHP, so please, easy with the flames about how nasty the code is.
    You can find it at:
    http://www.joshuatompkins.us/downloads/get_posts.phps

  2. davidchait
    Member
    Posted 10 years ago #

    You can already set $cat (I believe) to an inclusive or exclusive category for the next use of the posts loop (now that you can do multiple posts loops...). Some of that is changing in the newer releases, maybe moving toward using params into calls.
    If you search this site for posts related to single category or show one category or some such, there's a dozen threads already. Also look at wiki.wordpress.org.
    -d
    CHAITGEAR

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.