skip to Main Content

Add New “Blocks” To The Blog Post Layout

Important: See our new snippet for adding a custom block with a custom function output so you do NOT have to create a new file for the output (if you didn't want to)

/**
 * Example function for adding new "blocks" to the blog post layout manager.
 *
 * After adding your new blocks simply create a new file with the name "blog-single-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. In the example below the key would be "advertisement" so you would create
 * a file called blog-single-advertisement.php for your child theme and place it as mentioned above.
 *
 * IMPORTANT: This module will be disabled by default, so you will have to go to the Customizer to enable it.
 *
 * @link https://total.wpexplorer.com/docs/snippets/new-blocks-blog-post-layout/
 */
add_filter( 'wpex_blog_single_blocks', function( $blocks ) {
    $blocks['advertisement'] = __( 'My Advertisement', 'total' );
    return $blocks;
} );
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