
Relevanssi sticky posts
By:
msaari on
Aug 8th, 2012 | syntax:
PHP | size: 0.54 KB | hits: 16 | expires: Never
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;
}