DPS, Add Category Classes

<?php
/**
* Display Posts Shortcode, add category classes
*
*/
function be_dps_add_category_classes( $classes ) {
$categories = get_the_terms( get_the_ID(), 'category' );
if( ! empty( $categories ) && ! is_wp_error( $categories ) ) {
foreach( $categoriess as $category ) {
$classes[] = 'cat-' . $category->slug;
}
}
return $classes;
}
add_filter( 'display_posts_shortcode_post_class', 'be_dps_add_category_classes' );
view raw functions.php hosted with ❤ by GitHub

For more information, see: https://wordpress.org/support/topic/can-you-set-font-size-and-color-per-category/

Display Posts Shortcode