geilt

AdLogic

Nov 13th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <?php
  2. /**
  3.          * Show/Hide on Post. Has option to override category and term check.
  4.          */  
  5.         elseif(is_single()):
  6.             if(empty($instance['posts'])):
  7.                 if(!empty($instance['categories']) && is_array($instance['categories'])):
  8.                     $categories = get_the_category(get_the_ID());
  9.                     foreach($categories as $category):
  10.                         if(!in_array( $category->term_id, $instance['categories']) ):
  11.                             return false;
  12.                         endif;
  13.                     endforeach;
  14.                 else:
  15.                     return false;
  16.                 endif;
  17.                 if(!empty($instance['tags']) && is_array($instance['tags'])):
  18.                     $tags = get_the_tags(get_the_ID());
  19.                     foreach($tags as $tag):
  20.                         if(!in_array( $tag->term_id, $instance['tags']) ):
  21.                             return false;
  22.                         endif;
  23.                     endforeach;
  24.                 else:
  25.                     return false;
  26.                 endif;
  27.             endif;
Advertisement
Add Comment
Please, Sign In to add comment