• I needed this and I mixed up some code with help of bcworkz
    in this thread LINK
    so thing is replace (around 270 line)
    $output .= "<div class='pfpItem entry-content>";

    with this:

    $post_categories = wp_get_post_categories( $child->ID );
    				$cats = array();
    
    				foreach($post_categories as $c){
    					$cat = get_category( $c );
    					$cats[] = $cat->slug ;
    				}
    
    				$classes = implode ( " category-",  $cats );
    
    			$output .= "<div class='pfpItem entry-content category-$classes'>";

    http://ww.wp.xz.cn/extend/plugins/posts-for-page/

The topic ‘How to add html,css class="category-" to posts’ is closed to new replies.