• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WPArena

WPArena

WPArena is a premium online resource site of WordPress and is focused on providing excellent WordPress Tutorials, Guides, Tips, and Collections.

  • News
    • Opinion
  • Tutorials
  • Reviews
    • Themes
    • Plugins
  • Comparisons
  • Collections
    • Education Themes
    • Genesis Child Themes
    • Best Responsive Themes
    • Medical WordPress Themes
    • Finance & Business Themes
    • Crowdfunding Themes
  • Resources
    • Inspiration
  • Services
WPArena » Tutorials
Tutorials

How To Create A Custom WordPress Page Template

Avatar of Editorial Staff Editorial Staff August 28, 2012

custom page template in wordpress
FacebookTweetPinLinkedInEmailPrint

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 or if you have any specific question, write down in comments.

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.

Steps To Create a 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:

https://gist.github.com/wpcount/297d1b1ff252e28a9cdccbb255d1d19e#file-new-page-template-php

Copy just 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 /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 Add 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 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 Settings 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 the blog as 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 www.site.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.

For more technical information about this subject :WordPress Pages

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.

Related Tags: Page Template

FacebookTweetPinLinkedInEmailPrint

Related Stories

  • How to Create Facebook Templates with Wix

    How to Create Facebook Templates with Wix

  • Online resources for WordPress Developers and Designers

  • Another Security Release WordPress 2.8.4

    Another Security Release WordPress 2.8.4

Avatar of Editorial Staff

Editorial Staff

Editorial Staff at WPArena is a team of WordPress experts led by Jazib Zaman. Page maintained by Jazib Zaman.

Reader Interactions

Share Your Thoughts Cancel reply

Before submitting your comment, we kindly ask that you read our comment policy. Your email address will remain confidential and will not be published or shared anywhere. If you subscribe, you will receive notifications regarding new comments.

Primary Sidebar

WordPress vs. Magento: Integrating the Platforms

Setup Google AMP in WordPress

How to Setup Google AMP in WordPress

Recent Topics

  • Top Premium WordPress Plugins & Themes
  • How to Improve WordPress Navigation Menu
  • Publishing Blog Posts via Email: WordPress and Blogger
  • Ultimate Guide to Managing WordPress Multi Sites
  • 27 Top SEO Companies in the World

Footer

Top

  • Services
  • Our Themes
  • Facebook
  • Twitter
  • Linkedin

Reviews

  • Beaver Builder Review
  • Beaver Themer Review
  • WP User Frontend Pro
  • Ninja Forms Review
  • MemberPress Review

More Reviews »

Resources

  • Best WordPress Plugins
  • WordPress Permalinks Structure
  • Email Management System
  • Envato Free Files
  • Advertise
  • Write for us
  • Disclosure
  • Terms
  • Privacy
  • Contact

Copyright © 2023 · All Rights Reserved · WPArena is a Project of TechAbout LLC.
We are not affiliated with Automattic or WordPress.

  • Advertise
  • Write for us
  • Disclosure
  • Terms
  • Privacy
  • Contact
Share this ArticleLike this article? Email it to a friend!

Email sent!