• Resolved Noel Forte

    (@fortissimo95)


    Hi-
    Currently I’m using this code to display a string of breadcrumbs ( Link / Link / Link) across the top of my archive pages.

    <?php
    	$cat_arguments = array(
    	  'orderby' => 'name',
    	  'parent' => 0
    	  );
    	$cats = get_categories($cat_arguments);
    	$i = 0;
    	foreach($cats as $category) {
    		echo '<li><a href="'.get_category_link( $category->term_id ).'">'.$category->name.'</a>';
    		$i++;
    		if ($i < count($cats)) {
    			echo '<span class="divider">/</span></li>';
    		}
    	}
    	?>

    However, I want to add a class to the li that contains the name of the currently displaying category. What’s the best way to do this?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Add a class on an li for "current category"’ is closed to new replies.