How Do I Add a Full Width Block in WordPress?

Adding a full width block in WordPress is a breeze. To do so, first you’ll need to create a new custom post type.

Name it whatever you like, but make sure to include “full width” in the name. Once you’ve created the custom post type, add the following code to your theme’s functions.php file:.

add_action( ‘init’, ‘my_fullwidth_block_init’); function my_fullwidth_block_init() { register_post_type( ‘fullwidth’, array( ‘label’ => __( ‘Full Width Block’, ‘my_theme’ ), ‘description’ => __( ‘A full width block for your posts.’ ), ‘public’ => true, ‘rewrite’ => array( ‘slug’ => ‘full-width-block’, ‘map’ => ‘my_theme_slug’, ) ) )); }

Next, you’ll need to add a custom template to use for your full width block. In this template, you’ll want to include the following code:

{{ content }}

And that’s it! Your full width block is now up and running in WordPress.