• Hi,

    Sorry if this is redundant but I can’t seem to find what I need.

    I’ve created a custom template called sitemap.php. It has the appropriate php coding in the top as below

    <?php
    /*
    Template Name: Sitemap
    */
    ?>

    If I create a new page and use that as the template, the page works fine.

    My problem is, I want to link directly to sitemap.php using my navigation links. In other words, I don’t want to create a page using the WordPress admin panel.

    I have tried so many things I won’t begin to list them but if someone can give me a hand, I would be grateful.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • What you are trying to do is not the way that WordPress works. Page templates are used to display the content of WP pages on. Thus you can’t link directly to them. You can have all the PHP and HTML code in the template. If that is what you have done, just create a WordPress page that uses the template and leave the entire WP page blank. It serves as a way to assign a known WP URL to the template and adds it to the site nav. All the page logic can be in the template.

    Thread Starter hixsonb

    (@hixsonb)

    That is what I was afraid of but just wanted to hear it from someone else.

    As stated, the way you mention works just fine but I was trying something new in a theme I am creating.

    Thanks stvwlf.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Linking to a Template file’ is closed to new replies.