LinqSEO

  • Home
  • Services
  • Blog
  • About
  • Contact
wordpress development sacramento

How to Make a Custom Page Template in WordPress

October 30, 2017 by JT Leave a Comment

Up until this point, you may have been mostly modifying your WordPress site with CSS. There is nothing wrong with that. In fact, adding just a couple of hundred lines of CSS to an out of the box theme along with quality images can produce an attractive website However, you are going to have to do more whether you want to or not. The next step usually involves creating custom page templates. To do so means getting into the PHP code. But don’t worry. You don’t need to be a professional programmer to make PHP modifications to your theme templates. In fact, there are several simple PHP modifications that will allow to really add a whole new layer of functionality to your website.

The most important place to start with modifying a WordPress theme is editing page templates and even making new ones. Most WordPress themes come with a standard page.php template. Below, I have detailed how to create a new page template. In this case, we will take a standard page.phptemplate file taken from the Twenty Fourteen theme and convert it into a custom full-width page template file. Keep in mind that this is a basic example and you should not limit yourself  to creating only a full-width template file. As you learn more, you gain the ability to make a whole array of custom page templates that can transform an average site into a dynamic one.

Create a custom full-width page template file

You can create a new page template either in a text editor like Sublime, Atom or Brackets and upload it to your site via FTP or create it directly in your Cpanel. For sake of time and not to overwhelm since you are just getting your feet wet, lets first learn how to do this via the Cpanel. When you get into your cpanel, click on your ‘public_html’ folder and then click on ‘wp-content’ followed by your ‘themes’ folder. When you get into your themes folder, look for template called page.php. This is the default template that displays your pages. Keep in mind that single.php is your post template, which can also be modified. Assuming that your page.php template includes the sidebar, simply open it up and copy and past all of the content. Below is an example page template from the Twenty Fourteen theme.

If you scroll down to the bottom of the code, you can see the call to the sidebar, which is written as . In your Cpanel, create a new file and name is something like full-width.php. Copy and paste the entire content from the page.php template into the full-width one. At this point, there are two things you need to do in order to make it full-width. At the top of the template, replace A template displaying all pages to Template Name: Full Width. Second, scroll down to the bottom of the page and simply erase <?php get_sidebar(); ?> . If you unsure, look at the code below.

After making those changes, save your document and return to the WordPress dashboard of your site. Create a new page and then visit the page template options on the right. You should now see a page template option called ‘Full Width’, which can now be used when you want to exclude the sidebar and have a full-width page.

full-width page template wordpress

If you were able to do this, then you have successfully created your first custom page template in WordPress. This is something to get excited about because as you learn, you can easily create custom page templates that are more dynamic and for various purposes.

Filed Under: SEO

Start a Discussion

Recent Posts

  • Creating a Popup in WordPress using Popup Maker and Contact Form 7 Plugins
  • How to Install Python on Windows 10
  • Locally Setup and Install WordPress On Windows Using WAMP
  • The SEO Guide for 2018; Content is King!
  • How to Use JQuery in WordPress
  • How to Create a Custom Homepage Template in a Genesis Theme
  • How to Add Google Analytics to WordPress Site Without a Plugin
  • How to Make a Custom Page Template in WordPress

Subscribe to our newsletter

Stay updated on the latest posts

Your email is safe with us

Liquid Web Dedicated Servers

Sacramento, California

916-767-9658

© 2021 · LINQ SEO