Forums

header.php template: knowing what template is used (3 posts)

  1. 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

  2. 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.

  3. alchymyth
    The Sweeper
    Posted 1 year ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.