Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Show/Hide on Post. Has option to override category and term check.
- */
- elseif(is_single()):
- if(empty($instance['posts'])):
- if(!empty($instance['categories']) && is_array($instance['categories'])):
- $categories = get_the_category(get_the_ID());
- foreach($categories as $category):
- if(!in_array( $category->term_id, $instance['categories']) ):
- return false;
- endif;
- endforeach;
- else:
- return false;
- endif;
- if(!empty($instance['tags']) && is_array($instance['tags'])):
- $tags = get_the_tags(get_the_ID());
- foreach($tags as $tag):
- if(!in_array( $tag->term_id, $instance['tags']) ):
- return false;
- endif;
- endforeach;
- else:
- return false;
- endif;
- endif;
Advertisement
Add Comment
Please, Sign In to add comment