• Blog

    Latest from our Blog

  • Tools

    Our Favourite WP Tools

  • Hosting

    Recommended Web Hosts

  • Coupons

    Get great money off deals

  • Themes

    WordPress Theme Directory

  • Plugins

    WordPress Plugins Directory

  • Promote

    Your WordPress Product

So you have spent your time developing the home page look of your site and you need to make the interior pages, but the site isn’t a blog so you don’t want posts to display on the inside as well. What happens when you need to switch it up? When one page needs a sidebar and another is full-width? Various different sidebars? WordPress allows you to change your page templates on every page using what they call “Page Attributes”.

In addition, you can make your own completely custom, non-editable content using this option and then create a page, naming it how you want it to appear in the site, and applying the page template in Page Attributes.

Your default template is the one that is named “page.php” in your template editor. Every theme typically has at least the following template breakdown:

  • Header (header.php) – Contains Doctype, Meta information, etc.
  • Main Page (index.php)
  • Page (page.php)

The index.php file is for the “loop” (or list of posts) which you can see on some WordPress site front pages (like WPlift) if the feed, and not a page, is set in the reading settings. It’s easy to confuse that with the page template which can be duplicated and edited for the specified design style of individual pages.

If you need to make your own page template, you can name it anything you want with a .php extension except for special ones that WordPress uses. You’ll need to do this using your FTP since there isn’t natively a duplicate option within WordPress.

You need to have the following at the beginning of the file:

<?php
/*
Template Name: Whatever This Is
*/
?>

Then to call your header information, follow with:

<?php get_header(); ?>

Anything else is completely up to you, so if you want to keep the page content the same and just change up the sidebar, you can do so by making a duplicate page and sidebar file, changing the name of the sidebar and pages (keeping the .php extension and making sure it doesn’t conflict with WordPress-set names), and changing

<?php get_sidebar(); ?>

to

<?php get_sidebar('pagename'); ?>

or by removing the sidebar include all together, you can have a full-width page (in addition to adjusting the code/CSS of course).

It might take some getting used to, knowing that the page template is for both post display and pages, but having the ability to further customize makes WordPress such a flexible tool for website development.


Post Tags

Author:

I've been working professionally as a graphic and web designer since 2003 for firms, in-house and as a freelancer. I'm currently a designer and web developer for Edge Webware in Miamisburg, Ohio. When I'm not designing, I'm also writing novels and audio dramas, doing voice-over work, and audio production.

Leave Yours +

2 Comments

Leave a Reply

* Required Fields.
Your email will not be published.

Search

Our Sponsors