-
-
Save DaDlugosch/6b962d2b366149a6818300572f692d68 to your computer and use it in GitHub Desktop.
Add an active class to the current tag in a tag cloud widget.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function carbon_tag_cloud_class_active($tags_data) { | |
| $body_class = get_body_class(); | |
| foreach ($tags_data as $key => $tag) { | |
| if(in_array('tag-'.$tag['id'], $body_class)) { | |
| $tags_data[$key]['class'] = $tags_data[$key]['class'] ." active-tag"; | |
| } | |
| } | |
| return $tags_data; | |
| } | |
| add_filter('wp_generate_tag_cloud_data', 'carbon_tag_cloud_class_active'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment