1

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

3 Answers 3

1

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');

1
  • 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, 2010 at 11:38
1

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

0

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: 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.)

1
  • 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, 2010 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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