From what I can tell, the answer is to use multiple loops. Although I haven’t been able to spot it in the code in query.php, it seems that when you ask for specific categories, the stickies are ignored.
I’m using a custom loop with get_posts(). Stripping out the category parameter and using a bare get_posts() call still doesn’t put the sticky post at the top.
This original topic thread was for a custom loop using query_posts() – according to the Codex both are supposed to work with the same parameters for WP2.6+
get_posts parameters
query_posts parameters
Sticky Post Parameters
Sticky posts first became available with WordPress Version 2.7. Posts that are set as Sticky will be displayed before other posts in a query, unless excluded with the caller_get_posts=1 parameter.
* array(‘post__in’=>get_option(‘sticky_posts’)) – returns array of all sticky posts
* caller_get_posts=1 – To exclude sticky posts being included at the beginning of posts returned, but the sticky post will still be returned in the natural order of that list of posts returned.
To return just the first sticky post:
$sticky=get_option('sticky_posts') ;
query_posts('p=' . $sticky[0]);
or
$args = array(
'posts_per_page' => 1,
'post__in' => get_option('sticky_posts'),
'caller_get_posts' => 1
);
query_posts($args);
Note: the second method returns only the more recent sticky post; if there are not sticky posts, it returns the last post published.
To return just the first sticky post or nothing:
$sticky = get_option('sticky_posts');
$args = array(
'posts_per_page' => 1,
'post__in' => $sticky,
'caller_get_posts' => 1
);
query_posts($args);
if($sticky[0]) {
// insert here your stuff...
}