-
-
Save kjohnson/b7877b886663a7e2c280 to your computer and use it in GitHub Desktop.
The Invisible Preview Page - Filters (Updated)
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 | |
if ( isset( $_GET['my_preview_page'] ) ){ | |
add_filter('the_title', 'my_preview_title' ); | |
function my_preview_title(){ | |
return "My Preview Page"; | |
} | |
add_filter('the_content', 'my_preview_content' ); | |
add_filter('get_the_excerpt', 'my_preview_content' ); | |
function my_preview_content(){ | |
return "My Preview Content Here"; | |
} | |
add_filter('template_include', 'my_preview_template' ); | |
function my_preview_template(){ | |
return locate_template( array( 'page.php', 'single.php', 'index.php' ) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment