2

I want to make a theme with an about page and a contact form,

Should I make a custom page meant specifically for it? (the blog is ment for mobile and I'm not looking for most flexibility, the page can be all hard coded but the text) And how would such page be created from the WP-Admin?

3
  • 4
    A theme should never contain a contact form. That’s plugin territory.
    – fuxia
    Commented Jun 13, 2012 at 15:56
  • 1
    This isn't necessarily true. I have a contact form that users can enable with theme options which allows them to input the destination e-mail. Commented Jun 13, 2012 at 21:03
  • @siouxfan45 Technically possible !== makes sense. Users should have a choice.
    – fuxia
    Commented Jun 14, 2012 at 10:44

1 Answer 1

3

If you're building a custom theme, I'd recommend creating custom page templates - one each for an About and a Contact page.

This gives your end users some flexibility. They can define their own page and select your template - so "About" could be used for "About," "About Me," "Our Story," etc. No need to know which page will be used for the about page in advance.

Just define two extra php files in your theme:

  • about-template.php
  • contact-template.php

Then make sure the files include a header that looks something like this:

<?php
/*
Template Name: About Page
*/
?>
... The rest of your regular template file continues below ...

Using Page Templates

One these custom page templates are defined by your theme, there's nothing special you need to do to use them. Just create pages like you normally would within WordPress, but make sure you select the template you want to use from the Page Attributes meta box:

WordPress Page Attributes

This example is from my theme, which defines additional "Archive," "Blog," and "Landing" templates. The Default Template is just what it sounds like, the default page.php template.

2
  • thanx, and how do I activate them from inside wp-admin?
    – ilyo
    Commented Jun 13, 2012 at 19:40
  • 1
    See my edit for details.
    – EAMann
    Commented Jun 13, 2012 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.