• Resolved Doodlebee

    (@doodlebee)


    I now have another stupid question. I’m trying to edit/create a template for static Pages, but the thing isn’t taking. I’ve looked at the documentation on how to create a page template, and it simply says all I have to do is add these few lines to the top of the template I need to use:

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

    Then name the file “snarfer.php”. Then, anytime the static Page of “snarfer” comes up, it’ll use the template defined (in this case, it’s the index page’s template – I just need the header text to change.)

    But this isn’t working for me. I’m trying to create a static “links” page, and I have saved the files as “links.php” and put the template name (as seen above) as “links”. Shows up fine and is editable in the Admin area, but when I go to view the site, it’s still using the default “page.php” file.

    Have I named the file incorrectly? I tried changing it (like with the category templates) to “page_id-5.php” (my links Page id is “5”) to see if that would take, but it was a no-go. Any ideas would be appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The trick with the Page Templates is that you can (and, actually, should!) edit the template file: e.g. for the links.php instead of the Loop put there onme of the Links Manager template tags (see the Codex) and do not write anything in the admin panel when in Write > Write Page subpanel, just create the new Page by using the Links template – and you’ll have all your links displayed on that Page (provided you made a zillion links in the Manage > Links section).

    You need new and/or different Page template only for the Pages you want to look different or to have a special content (like the Archives or Links or Contact etc.)

    When you’re writing a page that you want to use the links.php template, you have to set it as the links template on the sidebar thing by the post box

    Thread Starter Doodlebee

    (@doodlebee)

    >>When you’re writing a page that you want to use the links.php template, you have to set it as the links template on the sidebar thing by the post box<<

    LOL – that’ll teach me to write the post *before* I’ve made the template. Holy crap, I feel like an idiot. I went in and edited the Page in question, and changed the template to “links” – BAM it worked.

    Duh me. (my favorite color is clear!)

    Thanks a bunch!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Page Templates’ is closed to new replies.