• Just a quick question… is there a way to display the category slug in a template (not the name of the category)?

    For example if I had a category called ‘Post Category’ is like to display the category as a slug so I can apply a style for it, so I’d like it to be displayed as post-category.

    I’d then use CSS so I can apply a style like this…

    <span class=”post-category”>

    Not sure if this really makes sense?

Viewing 1 replies (of 1 total)
  • This function returns the cat slug for the cat ID passed into it

    ?php function get_cat_slug($cat_id) {
    	$cat_id = (int) $cat_id;
    	$category = &get_category($cat_id);
    	return $category->slug;
    } ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Display category slug in template (not category the name)’ is closed to new replies.