Skip to content

Instantly share code, notes, and snippets.

@robertannett
Created May 24, 2021 11:22
Show Gist options
  • Save robertannett/1c5350847dff1f840f0b11422a9ac8a7 to your computer and use it in GitHub Desktop.
Save robertannett/1c5350847dff1f840f0b11422a9ac8a7 to your computer and use it in GitHub Desktop.
WP Template Finder
// Place me in the header
<?php if (defined('WP_DEBUG') && true === WP_DEBUG) { ?>
<div style="background: lightslategray; color: white; position: fixed; bottom: 1rem; right: 1rem; z-index: 9999; padding: 1.5rem 2rem 0.5rem;">
<p style="color: white; font-weight: bold;">DEBUG INFO</p>
Page ID: <?= $post->ID; ?><br />
Post Type: <?= $post->post_type; ?><br />
Template: <?= basename(get_page_template()); ?></p>
<hr />
<p><a href="/wp-admin/post.php?post=<?= $post->ID; ?>&action=edit" style="text-decoration:underline; color: white;"><b>Edit Page</b></a></p>
</div>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment