Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to build a featured posts with a "tabbed" interface in my homepage. I'm using the "sticky" option of the posts in order to get them out of the main loop and in the "featured tabs". No problem here.

The problem is I can't control the stickies order. Is there a way to set the order of sticky posts? A plugin, custom field... Is this stickies approach completely wrong?

Thanks

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

It sounds like you want to use the 'sticky' functionality as a replacement for a tag or a category.

Why not just put all the posts you want in a 'tab' category, then call your query for that category. You can use orderby in fancy ways (such as by post_meta($tab = get_posts('category=tab&orderby=date');

share|improve this answer
    
Thanks, I think I'll follow the category approach. But in one case or another, I won't be able to sort the posts manually... Can't even use sticky to make a post stay in first tab longer because in a category listing it won't work (I guess)... –  fana Oct 3 '10 at 11:38
add comment

You can use the Post Types Order it's the easiest way for posts order within categories or custom taxonomies

share|improve this answer
add comment

If you want the posts in reverse chronological order, you can do this:

$sticky = get_option('sticky_posts'); rsort( $sticky );

There are more options for sorting. I'll be able to provide a more detailed answer on Monday if someone hasn't already done so

Update: Just noticed something really close here: http://wordpress.stackexchange.com/questions/958/excluding-sticky-posts-from-the-loop-and-from-wp-query-in-wordpress

Be sure to change the 'post__not_in' key to post__in .

orderby options are here: http://codex.wordpress.org/Function_Reference/query_posts#Orderby_Parameters

This may also prove useful: http://www.cmurrayconsulting.com/software/wordpress-sort-query-by-post-in/

(Forgive me for not testing: I'm getting ready to catch a train soon.)

share|improve this answer
    
Thanks, but imagine this: I need to choose 6 posts and make them sticky and then sort them so I can control which one appears first, second... Maybe the stickies are definitely not the way to go... –  fana Oct 2 '10 at 17:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.