Snippets: Trim Post Types Grid Title

This sample snippet shows you how to trim the Post Types Grid title to reduce the title to a specific number of words.

add_filter( 'vcex_shortcode_loop_atts', function( $atts, $module = '' ) {
	if ( 'vcex_post_types_grid' == $module ) {
		$atts[ 'post_title' ] = wp_trim_words( $atts[ 'post_title' ], 5, '…' );
	}
	return $atts;
}, 10, 2 );