Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'relevanssi_hits_filter', 'my_stickyposts_hits_filter' );
- function my_stickyposts_hits_filter( $data ) {
- $hits = $data[0];
- $regularposts = array();
- $stickyposts = array();
- $query = $data[1];
- foreach ( $hits as $key => $hit ) {
- if ($hit->ID == X && $query == "Y")
- $stickyposts[] = $hit;
- else $regularposts[] = $hit;
- }
- $filtered_hits = array_merge($stickyposts, $regularposts);
- $filtered_data = array( $filtered_hits, $data[1] );
- return $filtered_data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement