[wp-testers] Highlight current category...

David House dmhouse at gmail.com
Fri Oct 28 09:22:54 GMT 2005


On 28/10/05, Austin Matzko <ajmatzko at hotmail.com> wrote:
> Good idea!  I turned it into a little plugin that I think does the same
> thing:
>
> function wp_current_category_class_attribute ($thelist) {
>         if (!('' == single_cat_title('', FALSE))) {
>                 $category = single_cat_title('', FALSE);
>                 $string = '/(<a href.*)(>.*' . $category . ')/';
>                 return preg_replace("$string"," $1 class=\"current-cat\" $2",$thelist);
>         }
>         else return $thelist;
> }
> add_filter('list_cats','wp_current_category_class_attribute');

I think it probably existed better as a core patch: as we already do
this for pages, it makes sense to do it for cats as well. Amanzimtoti,
if you submitted the core patch with Ryan's suggestions to Trac, it'd
almost certainly get included.

Great work!

--
-David House, dmhouse at gmail.com, http://xmouse.ithium.net


More information about the wp-testers mailing list