Advertisement
Guest User

Untitled

a guest
Feb 6th, 2012
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <?php
  2. // If is category or subcategory of $cat_id
  3. if (!function_exists('is_category_or_sub')) {
  4. function is_category_or_sub($cat_id = 0) {
  5. foreach (get_the_category() as $cat) {
  6. if ($cat_id == $cat->cat_ID || cat_is_ancestor_of($cat_id, $cat)) return true;
  7. }
  8. return false;
  9. }
  10. }
  11. ?>
  12.  
  13. <?php if (is_category_or_sub(4)) : ?>
  14.  
  15. <?php load_template(TEMPLATEPATH . '/cat_videopagine.php'); ?>
  16.  
  17. <?php elseif (is_category_or_sub(5)) : ?>
  18.  
  19. <?php load_template(TEMPLATEPATH . '/cat_speciali.php'); ?>
  20.  
  21. <?php else : ?>
  22. DEFAULT
  23.  
  24. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement