To add custom CSS class to all post titles in Views, please add this code to file functions.php in the theme’s folder:
// Content Views Pro - add custom class to post title
add_filter( 'pt_cv_field_title_class', 'cvp_theme_field_title_class', 100, 1 );
function cvp_theme_field_title_class( $args ) {
$custom_class = 'CLASS_NAME_HERE';
$args .= ' ' . $custom_class;
return $args;
}
If the custom class name is dynamic, for example it is value of a custom field of post, please replace this code:
$custom_class = 'CLASS_NAME_HERE';
by this code:
# To use custom field value as class name
global $post;
$meta = get_post_meta( $post->ID );
if ( !empty( $meta[ 'CUSTOM_FIELD_KEY_HERE' ][ 0 ] ) ) {
$custom_class = $meta[ 'CUSTOM_FIELD_KEY_HERE' ][ 0 ];
}
(replace CUSTOM_FIELD_KEY_HERE with your value).
Best regards,