Skip to content

Snippet: Move Page Header Title Area into Site Header

The following snippet can be used to move the page header title area into the site header area. I'm not sure why you would ever do this, but it is possible! Just be careful when using certain header styles because it could break the layout.

/**
 * Move the page header title into the site header.
 *
 * @link https://total.wpexplorer.com/docs/snippets/move-page-header-title-to-header/
 */
add_action( 'init', function() {

	// Remove page header title from default hook
	remove_action( 'wpex_hook_main_top', 'wpex_page_header', 10 );

	// Insert page header title into the site header at the very bottom
	add_action( 'wpex_hook_header_bottom', 'wpex_page_header', PHP_INT_MAX );

} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top