Created
October 14, 2015 05:09
-
-
Save generatepress/84bae0e5ac0d94ce46f7 to your computer and use it in GitHub Desktop.
Override Generate Sections Custom Page Template
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
add_action( 'wp','generate_override_sections_template' ); | |
function generate_override_sections_template() | |
{ | |
remove_filter( 'template_include', 'generate_sections_page_template' ); | |
} | |
add_filter( 'template_include', 'generate_sections_custom_page_template' ); | |
function generate_sections_custom_page_template( $template ) { | |
global $post; | |
$use_sections = ( isset( $post ) ) ? get_post_meta( $post->ID, '_generate_use_sections', TRUE) : ''; | |
if ( isset( $use_sections['use_sections'] ) && 'true' == $use_sections['use_sections'] ) { | |
$new_template = get_stylesheet_directory() . '/generate-sections-page-template.php'; | |
if ( '' != $new_template ) { | |
return $new_template; | |
} | |
} | |
return $template; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment