Echo template names/file paths like Magento in WordPress

Just paste the following code in your child theme’s functions.php file and it will display the template paths in wordpress. It is important to note that the path will only be visible to the logged in users so I highly recommend to remove this function from your codebase before deploying the website to LIVE.

 
 // REMOVE - show template name
 add_action('wp_head', 'show_template');
 function show_template() {
 global $template;
 global $current_user;
 get_currentuserinfo();
 if ($current_user->user_level == 10 ) print_r($template);
 }
 // REMOVE - end show template name

Leave a Reply

Your email address will not be published. Required fields are marked *