Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function stickies_and_old($posts)
- {
- if (is_category() || is_tag() )
- $posts = sort_stickies($posts);
- else
- return $posts;
- return $posts;
- }
- add_filter('the_posts','stickies_and_old');
- function sort_stickies($posts)
- {
- $sposts = array();
- $stickies = get_option('sticky_posts');
- foreach($posts as $post_index => $dpost):
- if (in_array($posts[$post_index]->ID,$stickies)) :
- $sposts[] = $dpost;
- unset($posts[$post_index]);
- endif;
- endforeach;
- $posts = array_merge($sposts,$posts);
- return $posts;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement