Hi,
in my site i need to restrict widget for category page. Plugin work properly only after editing the file restrict-widgets.php in this way:
….
elseif(is_page()) {
$found_main = isset($instance[‘rw_opt’][‘pageid_’.$post_id]) ? TRUE : FALSE;
/* ADDED CODE */
$post = $wp_query->post;
$categs= get_the_category( $post->ID );
$categ = $categs[0];
$catprop = ‘category_’.$categ->term_id;
if (isset($instance[‘rw_opt’][$catprop])) {
$found_main = isset($instance[‘rw_opt’][$catprop]) ? TRUE : FALSE;
}
}
elseif(is_singular())
{
$found_main = isset($instance[‘rw_opt’][‘cpt_’.get_post_type($post_id)]) ? TRUE : FALSE;
if(is_single() && $found_main == FALSE)
$found_main = isset($instance[‘rw_opt’][‘others_single_post’]) ? TRUE : FALSE;
/* ADDED CODE */
$post = $wp_query->post;
$categs= get_the_category( $post->ID );
$categ = $categs[0];
$catprop = ‘category_’.$categ->term_id;
if (isset($instance[‘rw_opt’][$catprop])) {
$found_main = isset($instance[‘rw_opt’][$catprop]) ? TRUE : FALSE;
}
}
elseif(is_category()) {
/* ADDED CODE */
//$found_main = isset($instance[‘rw_opt’][‘category_’.get_query_var(‘cat’)]) ? TRUE : FALSE;
$post = $wp_query->post;
$categs= get_the_category( $post->ID );
$categ = $categs[0];
$catprop = ‘category_’.$categ->term_id;
$found_main = isset($instance[‘rw_opt’][$catprop]) ? TRUE : FALSE;
}
…
otherwise the widgets were not filtered.
It’s right? Any idea?
Federico