"Landing Page" Template Without Header and Footer
Registers a "Landing page" block template for pages that shows only the page content, with no site header, footer or title, for campaign and sales pages (WordPress 6.7+).
Opens WPIDE on
Code
add_action( 'init', function () {
if ( ! function_exists( 'register_block_template' ) || ! wp_is_block_theme() ) {
return;
}
register_block_template( 'wpide//landing-page', array(
'title' => 'Landing page',
'description' => 'Page content only, without header, footer or title.',
'post_types' => array( 'page' ),
'content' => '<!-- wp:group {"tagName":"main","layout":{"type":"constrained"}} --><main class="wp-block-group"><!-- wp:post-content {"layout":{"type":"constrained"}} /--></main><!-- /wp:group -->',
) );
} );
Notes
Choose it in the page sidebar under Template. Works with block themes; older WordPress versions are skipped.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.