sideblog(katesgasis) – exclude from archive/search
-
Hi!
As much as I love this plugin, there are two areas it doesn’t cover: exclusion from archive and search pages. While the latest release has an option for exclusion it only addresses the index page & rss. Is there any decent way to extend (with proper coding) the exclusion feature to include archive/search pages?
I’ve tried a hack using in_catergory within THE LOOP but to me it’s more a kludge and doesn’t even cover all aspects of proper exclusion (e.g. if there are no other posts than sideblog ones in a month).
For reference, I’ve included the current (v3.0) hooks used for exclusion, see below.
Thanks for your support!
Olivercode
add_filter(‘posts_where’,’sideblog_where’);
add_filter(‘posts_join’,’sideblog_join’);function sideblog_where($query) {
$sideblog_options = get_option(‘sideblog_options’);if(is_home()){
if($sideblog_options[‘setaside’]){
$query .= ” AND category_id NOT IN (” . implode(“,”, $sideblog_options[‘setaside’]) . “) “;
}
} else if(is_feed()){
if($sideblog_options[‘excludefromfeeds’]){
$query .= ” AND category_id NOT IN (” . implode(“,”, $sideblog_options[‘excludefromfeeds’]) . “) “;
}
}
return $query;}
function sideblog_join($query) {
global $wpdb;
if(is_home()||is_feed()){
if(!is_category()){
$query .= ” LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) “;
}
}
return $query;
}
/code
- The topic ‘sideblog(katesgasis) – exclude from archive/search’ is closed to new replies.