Created
September 27, 2018 12:32
-
-
Save OksanaRomaniv/03e5086b79800484a93f76f1f234b21e to your computer and use it in GitHub Desktop.
Filter / Bypass front-page.php template to use custom template as static page (WordPress)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add this snippet to your funstions.php to use any custom template as you static front page if your theme has front-page.php // that overwrites custom template. This also supports page templates created with a page builder. | |
add_filter( 'frontpage_template', 'mc_filter_front_page_template' ); | |
/** | |
* Bypass font-page.php. | |
* | |
* @param string $template Custom Template Slug. | |
* @return string | |
*/ | |
function mc_filter_front_page_template( $template ) { | |
if ( is_page_template( array_keys( wp_get_theme()->get_page_templates() ) ) && is_front_page() ) { | |
return ''; | |
} | |
return $template; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment