featured posts order

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?

Read More

Thanks

Related posts

Leave a Reply

3 comments

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

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