Enable Custom Page Template for Static Front Page in WordPress

Page template settings in WordPress backend

WordPress will ignore your page template settings for the static front page with themes that include their own front-page.php. Here is a quick filter that checks for a page template setting and loads that one instead:

add_filter( 'frontpage_template', 'enable_custom_template_front_page' );

function enable_custom_template_front_page( $template ) {

	// Check if a custom template has been selected
	if ( get_page_template_slug() )
		return get_page_template();

	return $template;

}

Use Contact Form 7 to collect business leads and enquiries? I created Storage for Contact Form 7 plugin which stores them safely in WordPress database.

Get it now for only $19 →

Leave a Reply