Snippets: Tweak Post Types Grid Total VC Module Output

IMPORTANT: The theme now has filters added to each section of a grid making it easier to add content before/after it. This method still works but it's not as efficient. Have a look at the new snippet example here.

// The function takes in the "blocks" which is an array of the different sections which
// include: media, title, date, categories, excerpt, read_more
// The attributes variable returns all the settings from the module, for example if you are
// targeting a specific grid on the site you can give it a Unique ID and check for it using
// if ( 'my-unique-id' == $atts['unique_id'] )
add_filter( 'vcex_post_type_grid_entry_blocks', function( $blocks, $atts ) {

	// Override entry media
	$blocks['media'] = function() {
		return 'Your custom media output - this will replace the default image with your custom output';
	};

	// Add new section after the title
	// Important because the filter runs before the look by using an inline function we can use core WP functions like get_the_ID() do not return a simple value for the new key if you need to pull post data
	$blocks = wpex_array_insert_after( 'title', $blocks, array(
		'custom_block' => function() {
			return 'my custom block output';
		}
	) );

	// Return blocks
	return $blocks;

}, 10, 2 );
All PHP snippets should be added via a child theme's functions.php file.