
Show template file name in wordpress
Answers 2
-
--PATH wp-content\themes\<yourTheme>\functions.php
add_action('wp_head', 'show_template'); function show_template() { global $template; echo basename($template); }
0If you want to know your current working template file name in wordpress you can see it using this code snippet. Just copy paste this code snippet in your functions.php, it will display the current working template file name. Using this code snippet you can know which template file in your theme is actually being used on a specific page. -
--PATH wp-content\themes\<yourTheme>\footer.php
<?php global $template; echo basename($template); ?>
0You can just use it directly in the template file (footer.php or header.php) at any place to view your template file name.
Random Code Snippet Queries: Wordpress
- Remove class from body tag in wordpress
- How to display author avatar in Wordpress 5
- Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home/xxx/public_html/wp-includes/plugin.php on line xxx
- Remove every class and ID from the wp_nav_menu
- Add new class to body tag in wordpress