Hey there commumity this is my first question as a dev.
I have made a list of the categories that are inside my custom post type by quering them. The problem is that I cant find a way to keep which class is active from this list even after reloading the page. I tried first with css but it didint work. I tried to add manually a class with jQuery but that didint work either.[check second block code] `
<?php $wcatTerms = get_terms('portfolio_category', array('hide_empty' => 0, 'parent' =>0)); foreach($wcatTerms as $wcatTerm) : ?> <ul> <li class="cat-cloud-link"> <a href="<?php echo get_term_link( $wcatTerm->slug, $wcatTerm->taxonomy ); ?>" class="currentItem"><?php echo $wcatTerm->name; ?></a> <ul> <?php $wsubargs = array( 'hierarchical' => 1, 'show_option_none' => '', 'hide_empty' => 0, 'parent' => $wcatTerm->term_id, 'taxonomy' => 'portfolio_category' ); $wsubcats = get_categories($wsubargs); foreach ($wsubcats as $wsc): ?> <li class="cat-cloud-link"><a href="<?php echo get_term_link( $wsc->slug, $wsc->taxonomy );?>"><?php echo $wsc->name;?></a></li> <?php endforeach; ?> </ul> </li> </ul> <?php endforeach; ?> </div>`