Skip to content

Alter Meta Sections (date, comments, author, etc) For Custom Post Types

Important

While you can do this via code, you can also control this via the Post Types Unlimited plugin when adding custom post types or even better instead of using the default entry layouts create a custom card.

// Alter the custom post type meta blocks.
function my_alter_cpt_meta_blocks( $blocks ) {

	// Your meta blocks array ( you can move them around or remove some )
	// This is the default array you could also just use unset to remove any
	$blocks = array( 'date', 'author', 'categories', 'comments' );

	// Example of a meta section with a custom output
	$blocks['my_custom_block'] = function() {
		echo 'my custom content';
	};

	// Return blocks
	return $blocks;

}
add_filter( 'totaltheme/cpt/meta_blocks/entry_blocks', 'my_alter_cpt_meta_blocks' );
add_filter( 'totaltheme/cpt/meta_blocks/singular_blocks', 'my_alter_cpt_meta_blocks' );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
Related Snippets
Back To Top