Viewing 5 replies - 1 through 5 (of 5 total)
  • current page/single?

    what is that?

    if you have one, page.php handles pages.
    if you have one, single.php handles single post views

    I realize that doesnt answer your question, there is a way to do that, yes, but it’s much easier to just tell you the above,

    you could try this:

    <?php
    echo $_SERVER[‘PHP_SELF’];
    ?>

    Thread Starter shua

    (@shua)

    muskokee,
    thx for the reply! in placing the code…

    index.php is returned for each and every page.

    To clarify, I am looking for the template filename.

    I have created custom page templates, and I would like to write some conditions specific to a template filename. For example if the template has ‘form’ in its name then do xy or z.

    Thread Starter shua

    (@shua)

    for anyone wanting the solution, try this on for size:

    get_page_template

    Thanks for finding your own question out Shua…I was wondering the same thing. And if you want to get just the name of the file instead of the path. I used the following:

    $temp = get_page_template();
    $path = pathinfo($temp);
    $temp = $path['filename'] . "." . $path['extension'];
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display template by file name’ is closed to new replies.