skip to Main Content

Add Extra Content to Grid Elements

Rather then modifying the Post Cards element you should use the new Post Cards element and choose from a preset card style or create your own custom card via the Card Builder.

Every Total grid module for the page builder includes filters for each "section" so you can customize the output. For example if you insert the Post Type Grid there is a filter applied to the featured image, title, excerpt, button...etc. This way you can either override the current output or you can add additional content before/after it. This filter takes in the list of module arguments as well so if you want to target a specific grid you can give the grid a unique ID and then check that way. Have a look at the sample snippet below for adding extra content under the title for a post type grid with the unique ID of "my-custom-grid"

/**
 * Add extra content under the title for a Post Types Grid with a unique ID of "my-custom-grid"
 *
 * @link https://total.wpexplorer.com/docs/snippets/add-content-total-grid-modules/
 */
add_filter( 'vcex_post_type_grid_title', function( $output, $atts ) {
	if ( isset( $atts['unique_id'] ) && 'my-custom-grid' == $atts['unique_id'] ) {
		$output = $output . '<div class="new-grid-section">Some stuff here</div>';
	}
	return $output;
}, 10, 2 );
All PHP snippets should be added via child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)
Back To Top