Skip to content

Instantly share code, notes, and snippets.

@kjohnson
Last active October 22, 2015 17:29
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 kjohnson/b7877b886663a7e2c280 to your computer and use it in GitHub Desktop.
Save kjohnson/b7877b886663a7e2c280 to your computer and use it in GitHub Desktop.
The Invisible Preview Page - Filters (Updated)
<?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