Closed bobbingwide closed 1 year ago
In Fizzie's template-part.php
I changed the code to:
/**
* Produce some visual aid to the theme developer, showing where the template starts and ends.
*
*/
if ( defined( 'FSE_DEBUG') && FSE_DEBUG ) {
if (defined('WP_DEBUG') && WP_DEBUG) {
$wrapped = "<div class=\"WP_DEBUG\">template part start: $slug</div>";
$wrapped .= $content;
$wrapped .= "<div class=\"WP_DEBUG END\">template part end: $slug</div>";
$content = $wrapped;
global $_wp_current_template_content;
bw_trace2($_wp_current_template_content, "current template content", false, BW_TRACE_DEBUG);
}
}
I didn't bother to check if the user was logged in, nor if they had theme editing capability
just a check on FSE_DEBUG
and WP_DEBUG
.
<div class="WP_DEBUG">front-page.html</div>
<div>
with class="WP_DEBUG"
into each template file. Since I started creating the SB-debug-block plugin, where I encountered a couple of problems, and since I've not done much work on the internationalization (i18n) of templates and template parts I haven't really put much thought into the debuggability of templates and template parts.
So I may as well close this issue. The last commit was delivered in v0.1.1.
While analysing the problems I came across with Gutenberg 9.4.0 I developed an extension to
template-part.php
which added debug information visible in the front end. It sandwiched the output for each template part in some debug<div class="WP_DEBUG">
tags which contained the name of the template part.I then wrote some naff CSS to enable the information to be viewed on the front end.
Requirements