Snippets: Add New “Blocks” To The Blog Entry Layout

Note: Check out the newer snippet here with inline output options - https://wpexplorer-themes.com/total/snippets/custom-blog-entry-blocks/

/**
 * Example function for adding new "blocks" to the blog entry layout manager.
 *
 * After adding your new blocks simply create a new file with the name "blog-entry-YOUR_KEY.php"
 * and place this file at partials/blog/ in your child theme. Make sure to replace "YOUR_KEY" with
 * the key given in the array.
 *
 * IMPORTANT: This module will be disabled by default, so you will have to go to the Customizer to enable it.
 *
 * Default blocks: The default blocks included are featured_media, title, meta, excerpt_content, readmore
 * If you want to show/hide blocks conditionally without affecting the Customizer settings you should use the 'wpex_blog_entry_layout_blocks' hook instead which also allows you to display a custom output for your "block" without
 * creating a new template file!
 *
 */
add_filter( 'wpex_blog_entry_blocks', function( $blocks ) {

    // Add new block "advertisement"
    $blocks['advertisement'] = __( 'My Advertisement', 'wpex' );

    // Return blocks
    return $blocks;

} );

Result:

All PHP snippets should be added via a child theme's functions.php file.