How To Create A Custom WordPress Page Template
Neglecting the site for some time and running out of ambition to post new content, here is another more popular post from the past. Originally posted on July 9, 2007, this post is getting the most views on the site and should still be relevant today. Sorry but I will probably not answer your theme-specific questions so I suggest you read the comments section.
There may be times when you want to create a blog page or that looks different than a normal page. Or Perhaps you want to use WordPress to run your entire website but want the main page of your domain to look completely different than a typical blog. This is an easy way to customize WordPress that can be very easily accomplished by creating a custom WordPress page Template.
The first step is to create your desired page in HTML, I use an HTML editor since I am somewhat geek impaired and can’t actually write any code. In this case we are not going to add content to this page from within the dashboard so add all your meta tags for SEO. It will need a title, description, keywords, basically everything a regular static HTML page would need. After you create your new page you need to create a new WordPress page template. This can be done either in a text editor and FTP uploaded to your site or, since it is a small simple file you can create it directly in your hosting account’s control panel.
To create the new page template paste your HTML code into a text editor like Notepad, then paste the following PHP code directly above it like this:
| <?php /* Template Name: New Template Name */ ?> <html> |
Copy just the 2 lines of code above the <html> tag and paste it into your new template and change New Template Name to a name of your choosing. Save the new page template as a .php file. Something like front.php, and upload it to your hosting account in the template folder of your current WordPress theme. Don’t call your new template page.php! There is already one called that. In fact look in the themes directory to see what files exist to not create a duplicate.
You can look at your current page.php template to get clues as to what you may want to include in your custom page template like the header and footer or possibly the sidebar. But if you include everything in the custom page template as the regular page template why bother?
The directory to place the new page template in is blog/wp-content/themes/default. Where default is the currently active theme.
Since you are placing this new WordPress page template into a specific themes folder it will only be available when that specific theme is active. If you change themes you will need to place a copy of it into the currently active theme.
To create a new page template within your hosting accounts control panel. Browse to your blogs main directory, wp-content, themes, then click on your currently active theme. Create a new PHP file, call it whatever you wish, like above front.php, paste your HTML code and then the PHP code directly above it and save.
Creating Your New Custom Page
Login to your WordPress Dashboard, click Write then Write Page. Since we didn’t specify in the custom page template to get the content, or any other information for that matter, all we need to do here is create a new page and specify the page template to use.
Type a title in the title box, then look over to the right and click the Page Template drop down box, choose your new WordPress page template and click publish.
Using A Custom Static Front Page
If you want to use a your new custom page for a static front page you will first need to create another regular page as a URL as your blogs Posts Page . Create a new page and give it the title blog, or anything you want. Again don’t bother writing any content, on the right side type the same name as the title in the Post Slug box and click publish.
To specify using a static front page, click Options then the Reading subpanel. Choose the Static Page option, specify your new custom page as the front page and the newly created blog page as the Posts Page and click Update Options.
Note! You do not need a custom page template for a static front page. You can create a page with all the content on it you want for the front page, and then a blank page for the post page. Then choose the static front page option as above.
Now your blog will show your new custom page as the front page. But what about your blog? Where did it go? If you followed my directions and used blog as the the Posts Page AND if you have the postname in your permalink structure the URL should be YourBlogsURL.com/blog , so if your blog is in a directory called blog then the URL will be YourBlogsURL.com/blog/blog. Having a blog/blog URL isn’t all that cool huh? Well this is intended for use on a website ran entirely on WordPress without a static HTML front page. But you can use a different name in the title and Post Slug when you create the new Posts Page.
Now that your have read the entire post here is a short video to explain it.
For more technical information about this subject.
Another post on my other blog about Using A Static Front Page For WordPress
If you are using a static front page and your theme has a navigation bar you may want to tweak the navigation bar from showing the Home link and then the static front page link. Here is another guide to Customize WordPress Header Navigation Bar.
Customize WordPress Header Navigation Bar
Adding too many pages to a WordPress blog that has a navigation bar in the header can really make your WordPress blog a mess. There are options to control what pages are shown in the navigation bar and even a way to add external links.
Add Link To A Custom WordPress Footer
One of the easiest ways to customize WordPress is to add links to the footer of the themes template. You could add the link to any website you want and if your blog is part of your website adding a link to the homepage of your site will help your search engine rankings as well. This is a little WordPress Guide that will help interlink your website. Instructions with video…
How To Really Screw Up Your WordPress Blog
I get a lot of requests for help with WordPress blogs that are not working properly, look terrible or worse don’t show up at all. I have seen and have had to backward engineer some really interesting things for some people. So in my typical sarcastic style here is what to do if you really want to screw up your WordPress blog.
WordPress Version 2.9 Is Ready Or Is It?
Just before Christmas WordPress version 2.9 was released. If you haven’t already upgraded, and since this isn’t really a security release, I might suggest you wait for version 2.9.1 before doing so.
Burn Your WordPress RSS Feed At FeedBurner
Although your WordPress blog has a built-in RSS feed you may want to enhance it with FeedBurner. Here is an older how-to guide on burning your RSS feed with FeedBurner. From what I can tell it is still very much the sme as it was back when the post was mad originally.
Remove WordPress Blog Title And Description
There might be a situation when you have a custom WordPress theme or just a custom header and want to remove the WordPress blog title and or the description. There are several right ways to do this and one very very wrong way.
How To Add Images To A WordPress Post
Inserting images into a WordPress post is fairly easy to do, but you must be careful and make sure that the images are properly formatted, and the right size.
WordPress Blogging With An iPhone
The WordPress team has developed an iPhone app for WordPress that lets you write posts, upload photos, edit pages, and manage comments on your blog from your iPhone or iPod Touch.
WordPress 2.8.5 Another Security Release
Most of you that frequent your self-hosted WordPress site should be well aware of the new version, 2.8.5 now available. As with all incremental security releases, it is recommended that you upgrade as soon as possible.










