WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Accessing templates? (6 posts)

  1. WPusertoo
    Member
    Posted 3 years ago #

    Hi, I know this is incredibly basic, but after reading all the "template" documentation I can find I still don't get it!

    I want to create a page in twentyten using the archives.php template. I go to Pages > Add New, then I go to the Page Attributes sidebar and click on the Template dropdown menu. All that shows are "Default Template" and "One Column, No Sidebar" templates. How do I access all those others that are listed under Appearance > Editor? Or create my own? Thank you.

  2. Digital Raindrops
    Member
    Posted 3 years ago #

    Save archive.php with a new name and add at the start of the file your template name:

    <?php
    /**
     * My Archive Template.
     *
     * @package WordPress
     * @subpackage Twenty_Ten
     * @since Twenty Ten 1.0
     */
    ?>

    However before doing this you need to research a bit more about theme pages and templates and stepping into templates.

    Most template pages are based on page.php, the others have specific jobs and are called when you hit a link.

    Before jumping in it might be worth discussing here what you want a template page to do.

    HTH

    David

  3. WPusertoo
    Member
    Posted 3 years ago #

    Thank you, I was just wondering about custom templates for future reference.
    The documentation I've read indicated that I'm supposed to save (other articles say upload) the file, as you say... but that's what I don't see how to do. All I see is the "Update File" button under the frame where I can edit the text of the template files. Other than that, I can't find any means to save the template code?
    Thanks again.

  4. Digital Raindrops
    Member
    Posted 3 years ago #

    If you really want to learn more, then I have two sets of tutorials, these will teach some best practices, with the latest WordPress, and a number of free tools we work with.

    You would work local and learn all about templates, template parts, and many other theme files and edits.

    If I wanted to add a template page or make a change, I would always work local and upload via ftp, the danger of working with the online editor is that I could 'lock myself out' with a fatal error, and have to mess about transfering files via ftp.

    There are over 11,000 topics in these forums where the poster has a fatal error.

    HTH

    David

  5. WPusertoo
    Member
    Posted 3 years ago #

    Thank you!

  6. WPusertoo
    Member
    Posted 3 years ago #

    I had actually read the documentation listed above a couple of times. As it turns out, two things were tripping me up:

    1) In order for a given template to show up in the Template dropdown menu (in the Page Attribute sidebar, under Pages > Pages > Edit Page), the text "Template Name:" needs to be inserted before the file name in the text. So though I used the example above, it still didn't show up as a template option in the dropdown menu on the Edit Page until I added "Template Name:" as below:

    <?php
    /**
    * Template Name: My Archive Template.
    *
    * @package WordPress
    * @subpackage Twenty_Ten
    * @since Twenty Ten 1.0
    */
    ?>

    2.) I didn't see anywhere in the documentation where it told me to save the new template file by managing it through the directory -- rather than via the WP administrator panel. I kept looking for somewhere to click as I navigated through the WP administrator panel.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags