Skip to content

Instantly share code, notes, and snippets.

@OksanaRomaniv
Created September 27, 2018 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OksanaRomaniv/03e5086b79800484a93f76f1f234b21e to your computer and use it in GitHub Desktop.
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)
<?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