"Page Without Title" Template for Block Themes
Registers a page template that keeps the theme's header and footer but hides the page title, for pages that start with their own hero section (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//page-no-title', array(
'title' => 'Page without title',
'description' => 'Header, page content and footer, with no title.',
'post_types' => array( 'page' ),
'content' => '<!-- wp:template-part {"slug":"header","tagName":"header"} /--><!-- wp:group {"tagName":"main","layout":{"type":"constrained"}} --><main class="wp-block-group"><!-- wp:post-content {"layout":{"type":"constrained"}} /--></main><!-- /wp:group --><!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->',
) );
} );
Notes
Pick it under Template in the page sidebar. It uses your theme's "header" and "footer" template parts.
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.