thosecars82
Member
Posted 1 year ago #
Hello
How to know in the code under header.php whether the current page is displayed by the archive.php template? How to know in general in the header.php template what template is going to be used to display the current page? index.php, archive.php, page.php ....
Thanks
richarduk
Member
Posted 1 year ago #
Just put a line of text in each file e.g this is archive.php - hide it in comment tages <!--this is archive.php--> if you don't want anyone else to see it, then view source for your page.
if you look into the code of 'body_class()' template tag
http://phpxref.ftwr.co.uk/wordpress/wp-includes/post-template.php.source.html#l352
there seems to be no single, simple command to show which template file is used.
you probably need to copy and use part of this code to get the information you want.
depending on the purpose of this knowlegde, maybe using 'body_class()' would do it for you?