• I’m running WP 1.5 using the default theme (kubrick) and I’m wondering how I would go about creating a new template. I want to create a new template that I could use for “contact us” type submission form. Would I just clone the index.php and add my contact us form code to it? Is there anything special I would have to add?

Viewing 10 replies - 1 through 10 (of 10 total)
  • If this is just going to be a static page, I would suggest cloning page.php, removing the <?php the_content(); ?> tag and then putting your contact form and stuff where that used to be. You should also add something like

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

    to the top of the new file. And then you’d just have to make a new page through WordPress without putting anything in the content box and using the Contact template.

    Or you could just write a normal page and put your form code into the content box. I don’t know how WordPress would react to having form code in the content box though.

    I’ve tried the above instructions several times. I keep getting this error message when I “View” my new ‘About’ Page:

    Parse error: parse error, unexpected T_ENDWHILE in blog/wp-content/themes/default/about.php on line 33

    I’m using WP 1.5, Kubrick.

    Here’s what I have tried (with the above bad result): I copied my default theme’s ‘page.php’ template, renamed it “about.php,” uploaded it (to themes/default/about.php), then in my Admin area I “Created a Page” using the new template “About” that now appears in my dropdown menu on the “Write Page” page.

    I’m new to WP and php. Have read all the ‘make a template’ stuff I can find in the Codex. What am I missing here? I must be doing something dumb. Or I have a setting wrong somewhere?

    I do see an “ENDWHILE” in the page’s code, but remember, I just copied the code straight from the standard un-messed-with Kubrick ‘page.php’ file.

    The reason I’m not creating a Page based on a copy of my index.php template is because I wanted to use a different header for the About Page; and also I don’t want the sidebar.

    I saw the post here about putting in a different header on a new Page, too, but can’t get that to work either.

    So…basically you’re saying I have to make a whole new theme to get an About Page with a different header, no sidebar, and no parse error. Yeow. ??

    No….not at all – I just linked them anyway ??

    One way to create your page as you wish it to be:
    – Create a static page by following this:
    https://www.tamba2.org.uk/wordpress/static/

    – In that page EITHER reference a new css file that will contain all the details plus the new header OR in the blog css, add a new Header image (.header2 ?) and amend the static header to match.
    – In the static page, don’t have the sidebar

    That would work.

    Ah crap .. that will work of course, but in 1.5 you’ll need to assemble all the parts in Notepad first THEN cut it all up again ..

    Thanks for the link to the tamba thingy. I think that might just be IT. ?? I’ll keep tryin’.

    Just in case anyone ever comes here some day and wonders what happened:

    It all started for me when I decided I wanted to create an About Page (with a capital P). I am using default Kubrick in 1.5, and I wanted my new About Page to be just like my main/front/index page BUT with a different header (same size OK, but not same design/colors) and NO sidebar. Just a nice simple About Page. I even wanted to use the same footer as is on my front/main page.

    I have tried everything, and read everything, including the links above. I keep getting the parse error I posted above. I’m thinking now it might be something about wp-blog-header, which is not really mentioned in the newer stuff but is in the older help posts. Or maybe it’s something about where to upload the file after I make it in Dreamweaver, although that doesn’t seem too hard to figure out.

    You’re making this much more complicated, or you’re having some serious issues at your end.

    Make sure .htaccess is CHMOD so that it is writable by WP. I take it you have a page.php? In the pages section, write About as the title, select the template page or whatever it is called. Enter some text, and save. View the page. Does it display? If yes, well done. If no then continue:

    copy the page.php file and open it in Notepad.

    At the top add this:

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

    <?php include "header.php"; ?>

    If the include is there already, just remove one of them.

    I believe this is the part you need:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php the_content(); ?>
    <?php endwhile; endif; ?>

    Again this should be there, but hey, it might not be – I’ve never played with or ever used Kubrick.

    I tend to have the basic layout of the page in the template file.

    Save as about.php and upload it. Select the template for the About Page and view it. Does it work?

    I question the ue of WYSI editors for playing with template files. I suggest you use Notepad or Wordpad. Dreamweaver is better for layout, design etc but not really for making templates, at least in my experience. They can add their own tags, which are either deprecated or custom, and in some cases over used or unrequired.

    Keep it simple.

    Jinsan, thank you very much for the lucid explanation. It not only worked, it worked both ways you described. (BTW, I use DW without letting it add unnecessary code. )

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘how to create new templates?’ is closed to new replies.