How To Create A Custom WordPress Page Template
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.
If you liked this post, feel free to leave a comment that is relevant to the post or subscribe to the feed and get future articles delivered to your feed reader.
Sorry but due to the spamming of a few all comments are moderated and will appear when approved and all drive-by comments will be deleted!












Comments
How To Create A Custom WordPress Page Template…
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. T…
Jeff demonstrates how to give your lead page options – display options, content options, format options, html options. Your web page or blog can stand apart from those of the masses.
Carl Hendricks,
http://www.cehmagic.com/blog
Hey Houdy,
Nice job!, You certainly are giving your visitors a lot of precious info. This blog will be a hit!
By the way, you got a nice voice
Gamy
Jeff,
Your websites are a great inspriration. Thank you for all of the great ideas and tips you share with everyone.
It is a pleasure to be associated with such a knowledgable and generious person.
Morris
Hi Jeff,
You provide me what I was looking for. Good work.
Wolney
Nice work Jeff
I have done a few videos myself. I need some more practice though:-)
Mal
Hi Jeff,
Great video and very useful.
I need to get some videos going myself!
Cheers
Suzanne
Great Job Jeff, that is what i was looking for
Thanks, Elsa
thanks, this was helpful
[...] for the benefit of others reading this, I have instructions about this with video on my blog here: How To Create A Custom WordPress Page Template __________________ Jeff Houdyschell WordPress [...]
thanks bro!
[...] you want to customize your static front page, a related post with a video can be found here: How To Create A Custom WordPress Page Template WordPress Guide Share This Gregarious FeedFlare Sphere: Related ContentIf you’re new [...]
Your tuts was very helpful and i really love it! I have a favor can you create a tuts that i can post my static page with a post of blog in single template?
Jonathan, not sure what you mean please explain in more detail.
Jeff
Check this out man click
i use your tuts in my front page the first part is a post page of welcome that was written in write page and the second layer i wanted to display a single recent blog post.
Jonathan, It looks as if you accomplished that already. Or I still don’t understand your question.
Do you want the static front page to have the top area of text that is always the same and the lower area one particular blog post or the most recent blog post, or all the recent blog posts?
Oh man you are so nice! add me on your Im hehe thanks man for your help you have a BIG HEART, Continue your good stuff! have you visit my site? have you notice the 1st layer and the 2nd layer? its the same but i wanted to in the 2nd layer i want to display my single post of my blog. But on the first layer that was the post from write>page.
Jonathan , you can do what you want the other way around. instead of having a static front page, use a plugin called sticky post that shows one post on the top of the main page and the rest under that.
Sorry but I don’t know how to code a WordPress blog to it the way you want but I bet it can be done. Head over to the WordPress.org forum and serach or ask there.
Jeff
Hi Jeff,
Great tutorial. I am planning to use a static front page and you gave me th ehelp I needed.
One question though, is there a way I can get a part of the recent posts to appear on the static page? By using the optional exerptc.
Herb, I have never done that but I am sure it is possible. I have this site setup to show the first post and then excerpts. But if you take just the excerpt code and place it in the page template it should work.
here is a post that may help a bit to get you started: http://www.wordpressmax.com/customize-wordpress/full-excerpts
[...] As you can see using a static front page to run your website can be as easy as creating a few pages and changing a few options or you could get into some custom coding to really make it stand out and be different. All of the information you need to customize your WordPress powered site can be found online and I suggest starting at wordpress.org. One of the steps is covered here: How To Create A Custom WordPress Page Template [...]
[...] As you can see using a static front page to run your website can be as easy as creating a few pages and changing a few options or you could get into some custom coding to really make it stand out and be different. All of the information you need to customize your WordPress powered site can be found online and I suggest starting at wordpress.org. One of the steps is covered here: How To Create A Custom WordPress Page Template [...]
[...] review of up to where I’m at: ‘How to Create a Custom WordPress Page Template’, he suggests Blogging Forum and WordPress [...]
I like to think i’m learning, but when i learn one thing another comes along, 24hours in the day is just never enough, cheers for your insight
[...] To start you need to create a custom page template and I have already posted instructions about that here: How To Create A Custom WordPress Page Template. [...]
Great tutorial! Applying this to my theme right now – can finally finish and get it published. Thank you!!!
I have been visiting this site a lot lately, so i thought it is a good idea to show my appreciation with a comment.
Thanks,
Jim Mirkalami
Your awesome. A sincere thanks. I’ve been wanting to customize my blog for a long time. I rss-ed you too. Thanks!
Great article!
Just used this to implement a custom page on one of my site. May I add that there is some plugins that would allow to easily put a page as a static homepage.
Now saying that, I still had a problem since my menu was showing all the pages. So I used the King Page widget that would allow you to choose which pages to include and which to exlude.
Thanks again,
http://www.workathomechannel.com/blog
I like your blog theme. I want to use it on my blog.
Can you please tell me from where I can download these theme?
Many thanks
——————————————————————————–
Dan owner of the future gadgets blog future gadgets and inventions
Dan, most themes have a link to the designer in the footer and so does mine. The theme is called Networker but mine has been heavily modified. You can find it here:
http://antbag.com/themes/
great site , hopefully you get alot of visitors
New to this blog and looking forward to posting some useful info. Also enjoyed what is posted so far. Thanks to everyone.
Thanks, this was very useful – esp the video
hello,
I was wondering, can I have a page with a blog structure? Well my homepage has a blog structure, but I want to have another page in the same site to have a blog structure too.
I tried to make a template like the ‘index.php’ file, but It didn’t work.
Can you help me?
Twitter I am not sure what you mean. You can create another page in the WordPress dashboard that will look like your blog. But to create a static html page that matched your blog, if that is what you want, can be done, I guess, but that is well beyond what I can explain in a comment or probably in a post. There are just too many variables involved.
well let me see if I can explain what I mean in a better way.
I want to have a dynamic page where I can post several posts, something like your home page ‘http://www.wordpressmax.com/’.
Twitter, You can use a feed from your blog to supply content to a static html page if that is what you mean.
You a genious, thank you!!!!!
Great post – very helpful. Thanks a lot!
Hey just wanted to let you know how helpful this post has been for me…been looking to see how to do this for AGES but your post was just so easy to follow and it had really clear instructions. Now I just need to update all my themes!
I watched the video you made on “How to create a custom wordpress template” I loved it made a rather difficult task seem very very easy! I knew it was easy Just that everyone made it sound difficult. My question is I am using wordpress 2.6 I followed everything you said in the video but still my squeeze page does not show. What could I be doing wrong?
Luis, not sure what “it doesn’t show” means. If you followed the steps you should have seen the new custom page template to choose from when creating a new, or editing an existing page (not post). You might have missed a step or something.
Nothing will show until you create a page with the custom template, even if everything you want to show is in the custom template, to show it create a blank page with at least a title.
Remember the video I made is old and references a very different version of WordPress. The steps should still be the same but some of the menu choices have changed or are renamed but are still there in the dashboard.
[...] site can be found online and I suggest starting at wordpress.org. One of the steps is covered here: How To Create A Custom WordPress Page Template WordPress WordPress Guide Share This Gregarious FeedFlareIf you’re new here, you may [...]
First comprehensive tutorial I have seen about building custom page in Wordpress.
I searched some on Youtube, but none of them are as exhaustive as this one. You are really serving the WP community by giving such valuable content for bloggers and developers.
Thanks for this article and video. I have been looking under every darn rock on the internet for 3 days trying to find exactly what you shared.
FLY NAVY!
Cheers!
Mike
I always suprising how people create good front pages (in templates from WooThemes.com, for example). The so functional. And now you create this page. Thank you for information and video you shared. It is helpfull. Maybe you shoud create it as a downloadable e-book?
Great advice! thanks
every time when i create a template i want that it looks different than a normal page. front page is the main page, i think it would be more attractive . so thanks for such a great information.
[...] How To Create A Custom WordPress Page Template | WordPress Max This came in handy yesterday when dealing with Wordpress and a client that needed a static welcome page that required some php programming. (tags: blog Video wordpress-tutorials template tutorial howto custom wordpress diy website homepage tech page templates how-to hacks) [...]
Brilliant. This simple tutorial has saved me hours of anguish!
Great post. Thanks
This is a very informative post. Thank you very much.
I have successfully created a static home page and custom templates for my site.
I, however, have a question. I wish to add a menu item to the top menu which links to a page which is not from my blog, but exisits on my domain. How can I achieve it? Thanks for your help.
I already have a post to customize a navigation bar that includes how to hard-code a link in it.
Customize WordPress Header Navigation Bar
I wanted to create a matching wordpress template for my website. Your tips will be very useful for me in achieving my goal. Thank you very much !
This information is inded very useful for a novice like me. I am grateful to you for sharing it.
Thanks, that helped a ton.
I have always wanted to do this but found it to hard. HTML isnt my thing.
Although your post was great and made it seem less complicated
First, you can’t imaging how much work this post saved me! I know zero about any of this and you walked me through it.
I created a new page, which has a frame in it for homes for sale. When I created the new page, I copied most of another page, but left out the get sidebar (the whole reason for this exercise was to have the search results without the sidebar)
Now there is no sidebar, but the navigation for the new page is gone now as well! Any help would be appreciated.
Here is a link to the page with the code…..
http://album.headforhome.fastmail.us/public/public/Homes for Sale Full Page.php
George, you must have left out some critical code from the page template. I don’t “look at code” on themes unless compensated for it. I suggest trying again with all code in it and then deleting as little as possible in increments, checking as you go. I can do it for you for a fee; sorry I am a Capitalist pig.
thanks for this information. It’s helpfull for me.
Thanks for your help.
Now all i need is some code to not show all pages in the header.php file.
Great tutorial thank you
I really want the traditional, dynamic homepage to appear in on a Page (a formal wordpress page that is). I’ve created a static homepage but now I want that dynamic homepage to appear at http://www.site.com/news
Any insight on how to do this? All my attempts to futz with the page template are failing.
Paul read the last part of the post again it explains how to use a page called blog for the posts. In your case call the new page “News”.
Thanks Jeff, unless I’m doing it wrong though, that adds /News/ to the URL string for every other page.
I get site.com/News/News as the home page
Yes I can change the slugs
But I also get:
site.com/News/post_1 (a post)
site.com/News/Contact_us (a page)
site.com/News/About_us (a page)
Am I missing something? That’s less than ideal
Paul, it sounds like you changed the Permalink structure. Did you?
Create 2 pages, one for the static home page with the content on it you want to show. The other page can be called Blog or in your case News, do not put any content on that page. Go to Settings, Reading and choose the pages for the static front page and the blog loop/post page.
Then yes the regular posts will be on the URL:
site.com/News/post_1 (a post)
But the pages should not have the /News directory in the URL just the posts.
I have:
/%category%/%postname%/
Is that the problem? I’ve so royally screwed things up that I’m hoping you can confirm before I change something again.
No Paul that is a good permalink structure. The pages should not have the /news directory in them unless you are making posts instead of pages.
Also this is going beyond comments and it’s hard to fix what I can’t see.
Screwed it up
So now I have the home page, which is static, and which I’ve set at http://www.site.com, at
http://www.site.com/News (not site.com)
While http://www.site.com/News (which is set as the blog page) pulls up thethe home Page.
Let me just say ‘Thank You’!
I’ve been trying to figure out how to go to an all wordpress format for my site and could not find one single resource for creating a page ‘template’ to move my static html pages to.
Everyone else seems to confuse template with theme.
This is a godsent and saved me a long day of heartache.
Thanks a ton,
-Steve
That information is help me so well to create custom page. thank you very much.
Any clues as to what I could be doing wrong if i follow all your advice – put it in the right folder – and it doesn’t show up in the appearance editor or in the template dropdown box? i’ve tried refreshing and clearing the cache and waiting – to no avail…
Jeff Replied:
February 1st, 2009 at 8:37 am
Sorry TR but all themes are coded differently, hard for me to tell what is causing your issues.
The code I provided may not work now because it isn’t in plain text now after I changed themes, try this site for more:
http://www.binarymoon.co.uk/2007/06/wordpress-tips-and-tricks-custom-templates/
nice post. great for newbies.
Sorry, the comment form is closed at this time.