Posts in PHP

Highlight Current Post Category In WordPress Categories Widget Using jQuery PHP

This simple snippet of PHP code will apply the ‘current-cat’ class to any categories in the WordPress categories widget that the current post resides in.

Add this code to your single.php template file in your current template. Make sure you have a .current-cat class in your css.

This assumes jQuery is included and uses $ to declare it.