I am trying to show a widget only in specific pages with Widget Logic plugin in Wordpress but i cant make it work in both (Line2 and Line3) situations. If I try each part of the code is working great.
$cats = array('test1','test2','test3');
global $post; return (in_array(1317, get_post_ancestors($post))) || is_tax('categories', $cats);
global $post; return is_single() && has_term($cats, 'categories', $post->ID);
OK I added an if and working fine now in both situations...
$cats = array('test1','test2','test3');
global $post;
if ((in_array(1317, get_post_ancestors($post)))) || is_tax('categories', $cats)) {
return true;
}
elseif (is_single() && has_term($cats, 'categories', $post->ID)) {
return true;
}
else return false;