Posted By

S_Park on 09/16/11


Tagged

wordpress


Versions (?)

Highlight current Wordpress category on a single page 'wp_list_categories'


 / Published in: PHP
 

URL: http://codex.wordpress.org/Template_Tags/wp_list_categories

Uses the 'currentcategory' parameter of 'wplist_categories'. Add relevant CSS as appropriate...

  1. <?php // ...for 'wp_list_categories'
  2. if(is_single()) {
  3. $category = get_the_category();
  4. $class .= $category[0]->cat_ID;
  5. }?>
  6. <?php wp_list_categories('orderby=id&child_of='.$categoryObj->category_parent.'&hide_empty=0&title_li=&use_desc_for_title=0&exclude=5&current_category='.$class); ?>

Report this snippet  

You need to login to post a comment.