orderby and stiky post won't work as expected
|Reported by:||lifeless85||Owned by:|
|Component:||General||Keywords:||orderby, stiky, Wp_query|
i've discovered that if i use orderby parameter in my Wp_query, stiky posts don't get on top, i was expecting that they remain on top and sorted too by the parameter i've decided because i was not passing caller_get_posts.
for example this fits to:
by now the simplest way we have to do this is to do two custom loop and count the outputted posts like this:
$sticky=get_option('sticky_posts'); $args=array( 'showposts'=>2, 'post__in' => $sticky, 'caller_get_posts' => 1, 'orderby'=>'meta_value', 'meta_key'=>'from', 'order'=>'ASC' ); //do the loop here $args=array( 'showposts'=>2, 'post__not_in' => $sticky, 'caller_get_posts' => 1, 'orderby'=>'meta_value', 'meta_key'=>'from', 'order'=>'ASC' ); //do the second loop here
Notice that if we want 2 post we need to count how much have been outputted or they will be 4.
I've marked priority high because if people starts to use this features massively probabily fixing it in the future, would break backward compatibility for future versions.