How to add class for current category page
-
i’m using this code to list all categories on my menu:
<?php $args=array( 'orderby' => 'name', 'order' => 'ASC' ); $categories=get_categories($args); foreach($categories as $category) { echo '<li><a href="'. get_bloginfo('url').'#' . $category->category_nicename . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </li> ';} ?>
how to add class when i’m on the single page of the current category?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to add class for current category page’ is closed to new replies.