Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Add an id on post which is in a category #13053
    TheGoldFish
    Member

    Thanks for the link, it works!
    I’ve added this code into the funtions.php and my category appear in the “body”:

    // add category nicenames in body and post class
    function category_id_class($classes) {
    	global $post;
    	foreach((get_the_category($post->ID)) as $category)
    		$classes[] = $category->category_nicename;
    	return $classes;
    }
    add_filter('post_class', 'category_id_class');
    add_filter('body_class', 'category_id_class');

    Thanks for your help.

    in reply to: Add an id on post which is in a category #12972
    TheGoldFish
    Member

    Hi,
    Sorry my theme is the simple catch free.
    Thanks!

Viewing 2 posts - 1 through 2 (of 2 total)