Advertisement
alchymyth

category level dependant archive output

Apr 26th, 2011
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php  
  2. switch(count(explode('|', get_category_parents(get_query_var('cat'),false,'|') ) )-1) {
  3.     case 1:
  4.         echo "ancestor";
  5.         /*the code for the 'parent' list with descriptions here;
  6.         i.e. get_categories('parent=' . get_query_var('cat') ); etc*/
  7.         break;
  8.     case 2:
  9.         echo "parent";
  10.         /*the code for the 'category' list with descriptions here;
  11.         i.e. get_categories('parent=' . get_query_var('cat') ); etc*/
  12.         break;
  13.     case 3:
  14.         echo "category";
  15.         /*the code for the loop with posts of the category here;
  16.         i.e. query_posts(array('category__in' => array( get_query_var('cat') ) ) ); etc*/
  17.         break;
  18. }
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement