Hmm, ok i think this plugin will do it: http://wordpress.org/extend/plugins/astickypostorderer/
However out of curiosity, is there a way to do it natively with a query in wordpress? Something like:
loop through posts in this category -> if there is a post in ‘current category’ & ‘is a sticky’ then display it at the top, and limit it to 1
Suggestions or tutorial links?
Thanks!
Nadine
hi esmi,
I’ve referenced that page a few times, its been very helpful, but this time, I’m unsure about how to join current category & is sticky into a query. eg:
$current_category = category ID in a variable
<?php array=$sticky(
caller_get_posts=1,
post__in => $current_category && get_option("sticky_posts"),
posts_per_page=1
);
?>
<?php array=$sticky(
caller_get_posts=1,
post__in => array($current_category, 'sticky_posts';),
posts_per_page=1
);
?>
?<php query_posts('caller_get_posts=1&posts_per_page=1&category=$current_category&get_option("sticky_posts")'); ?>
They either come back blank, or pull all the posts across the board marked with sticky. I know I’m combining things improperly, I am just unsure of the proper way to do it. Sorry for the questions….the combining of items always gets me in WP. 🙂
Or maybe there’s a way to use is_sticky() ?
_n
Ah – I see the problem. I think it would be easiest to grab all stickies and then loop through to see if any of them are in your chosen category using in_category().
Got it.
<?php $sticky = array(
'post__in' => get_option('sticky_posts')
);?>
<?php query_posts($sticky); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
if(in_category($current_cat)) {?>
<?php the_content(); ?>
<?php } ?>
<?php endwhile; else: ?>
<?php endif; ?>
Thanks so much for your suggestion. 🙂
Nadine.