{Plugin Relevanssi] – Filter Posts
-
On my site (www.thedanceattic.com), I am using a plugin (Role Scoper) to limit access to certain post categories unless you are logged in to my site. I would like these same categories to be excluded from the search results if you are not logged in. For example if you search on “Rehearsal” you should not find very many posts however you find all of them. If you click on the first post, you are unable to open it due to the security however the excerpt gave you most of the post.
This functionality worked using the default WP search engine however I prefer the Relevanssi functionality. Is there a way to filter these category results when the user is not logged in?
Also, I am having an issue getting the date relevance filter to work. I put the code in the functions.php file and re-indexed but it doe not sort as I expected.
function date_weights($match) {
$post_date = strtotime(get_the_time(“Y-m-d”, $match->doc));
if (time() – $post_date < 60*60*24*7) {
$match->weight = $match->weight * 2;
}
else {
$match->weight = $match->weight / 2;
}
return $match;
}
add_filter(‘relevanssi_match’, ‘date_weights’);Thanks,
Mark
- The topic ‘{Plugin Relevanssi] – Filter Posts’ is closed to new replies.