Note: Instead of creating custom entry blocks you may want to look at creating a Custom Card design instead, it's easier and more awesome!
/**
* Any custom post type post entry can be altered via the wpex_{post_type}_entry_blocks filter
* which returns an array of the "blocks" or parts for the layout
* that will be loaded from partials/cpt/cpt-entry-{block}.php
*
* Default array: array( 'media', 'title', 'meta', 'content', 'readmore' );
*
* You can use the filter to add, remove or re-order elements in the array as you wish.
* Below is an example showing how to add a new block for a custom post type and remove one.
*
* After adding new blocks simply create a new file with the name "cpt-entry-YOUR_KEY.php"
* and place this file at partials/cpt/ in your child theme.
*
* IMPORTANT: Make sure to change {post_type} with your post type name
* IMPORTANT: Make sure to replace "YOUR_KEY" with the key given in the array (advertisement is the key for the block added below)
*
*/
function myprefix_cpt_entry_blocks( $blocks ) {
// Example 1 - Add new block "advertisement" ( requires template part for output )
$blocks['advertisement'] = __( 'My Advertisement', 'total' );
// Example 2 - Added in Total 4.0+
// Add new blocks with custom function output
// Below is an example with an anonymous function but you can use custom functions as well ;)
$blocks['custom_block'] = function() {
echo 'my custom block';
};
// Return blocks
return $blocks;
}
add_filter( 'wpex_{post_type}_entry_blocks', 'myprefix_cpt_entry_blocks' );