Last active
August 29, 2015 13:57
-
-
Save pbowyer/9766002 to your computer and use it in GitHub Desktop.
To show where one Wordpress template begins and another finishes, open wp-includes/template.php and replace function `load_template` with the one below. Then add the contents of `functions.php` to the end of your theme's custom functions file.
This file contains hidden or 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_filter( 'template_include', 'mysite_template_include', 1000 ); | |
function mysite_template_include( $template ){ | |
$comment_template = str_replace(array(TEMPLATEPATH, STYLESHEETPATH), '', $template); | |
echo "<!-- Template: $comment_template -->\n"; | |
include( $template ); | |
echo "<!-- End Template: $comment_template -->\n"; | |
return false; | |
} |
This file contains hidden or 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 | |
function load_template( $_template_file, $require_once = true ) { | |
global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID; | |
if ( is_array( $wp_query->query_vars ) ) | |
extract( $wp_query->query_vars, EXTR_SKIP ); | |
$comment_template_file = str_replace(array(TEMPLATEPATH, STYLESHEETPATH), '', $_template_file); | |
echo "<!-- Template: $comment_template_file -->"; | |
if ( $require_once ) | |
require_once( $_template_file ); | |
else | |
require( $_template_file ); | |
echo "<!-- End Template: $comment_template_file -->"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment