Kahi’s Highlight Used Categories, a plugin

Published: On Saturday, March 7, 2009

.[important] This plugin allows to highlight used categories – when you're browsing a post (or ev. a page) filed under some categories, these are (in the category list) marked by adding specific class.
  • Classes used-cat and eventually used-cat-parent are added to the particular lis (list-items) in each category-list (wp_list_category()).
  • Based on Show Active Category plugin by Dirk Jaster, inspired by a few comments to that article. Development sponsored by Miroslav Kučera.
  • Remember that there are automatically some classes added: cat-item-{ID}(always) and current-cat and current-cat-parent (when browsing a category).
  • Associated with one of my old posts

Download Highlight Used Categories plugin

  • Version: 1.0

Useful? Bookmark or share:

  • email
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Propeller
  • Twitter

Comments

  1. 1.  Dan wrote: On May 17., 2009 comment number 1

    Really a lifesaver plugin.

    I am not good with php, and I wasted 4 days trying to give custom class to active categories and parent cats on a single post view.

    But eventually your plugin did it on a fly!

    Thank you

  2. 2.  Rolph wrote: On August 20., 2009 comment number 2

    Hello and thanks for valuable plugin. But, I'm using a 3-level of sidebar menu a this plugin unfortunately highlights only current and parent elements. Could you update the plugin to highlight the whole path, for example:
    #menu-left > ul > li.active > ul > li.active > ul > li.current

    no matter how deep is last element, whole path will be „marked“ by li.active (or anything). Please could you do this?
    THX

  3. 3.  Kahi [author] wrote: On August 22., 2009 comment number 3

    ↪ Rolph Sorry, I don't have time now to do that. But you can add the class pretty simply with a single jQuery command…

  4. 4.  Tripp wrote: On March 9., 2010 comment number 4

    Thank you! I can't believe WP doesn't do this automatically.

  5. 5.  od3n wrote: On April 5., 2010 comment number 5

    why it display used-cat when on page? how to override it?

  6. 6.  Kahi [author] wrote: On April 7., 2010 comment number 6

    ↪ od3n it makes no sense to display used-cat on a page (when pages defaultly cannot be categorized)… Can you provide a link to that page?

  7. 7.  od3n wrote: On April 9., 2010 comment number 7

    http://wpkrea­tif.com/tentan­g/

    please take a look there. the top one are pages and below them are home & category list.

  8. 8.  Kahi [author] wrote: On April 9., 2010 comment number 8

    ↪ od3n Try to call <?php wp_reset_query(); ?> before your categories menu.

  9. 9.  od3n wrote: On April 12., 2010 comment number 9

    still doesnt work.

  10. 10.  od3n wrote: On April 12., 2010 comment number 10

    here the code :

    <li class=„current-catcat-item“><a href=„/“ title=„Laman Utama“>Laman Utama

    <!-- #access -->

  11. 11.  od3n wrote: On April 12., 2010 comment number 11

    <li class=„current-catcat-item“><a href=„/“ title=„Laman Utama“>Laman Utama

    <!-- #access -->

  12. 12.  Kahi [author] wrote: On April 13., 2010 comment number 12

    ↪ od3n Sorry, I don't have any other idea and time to check it deeper neither.

  13. 13.  Socit wrote: On June 22., 2010 comment number 13

    Hello, to solve point 5., change
    if (is_singular())
    to
    if (is_singular()&& !is_page())
    in the plugin code.
    Thanks for the plugin!

  14. 14.  Edom wrote: On September 15., 2010 comment number 14

    Does it work for custom post types?

  15. 15.  Kahi [author] wrote: On September 15., 2010 comment number 15

    ↪ Edom Haven't tried yet…

  16. 16.  andy wrote: On October 16., 2010 comment number 16

    Does it work for you guys in 3.01? No luck here.

  17. 17.  andy wrote: On October 16., 2010 comment number 17

    This helped :)

    wp_reset_query();

  18. 18.  missmobtown wrote: On October 29., 2010 comment number 18

    No, unfortunately I can't get any action in 3.01 either.

  19. 19.  Buddychimpz wrote: On January 22., 2012 comment number 19

    Kathy, I love you for this plugin!

I quit working with WordPress, comments are closed. My plugins will not be updated any more – at least not by me. Feel free to modify my source codes though… Also I am not able to provide support, sorry. –Kahi