Page Templates in WordPress

By default all Pages you create within WordPress will all use the same Default Template to control how the content is displayed.

Your current Theme and active Plugins may add additional Page Templates you can choose from and assign to a Page; changing how the Page looks and even what the Page contains.

Page Templates for Different Layouts.

A common use of Page Templates is to offer different layout designs for your content; with a Sidebar area for Widgets or a full width layout (without the Sidebar). Other choices might offer the Sidebar on the left or right.

Page Templates for Custom Post Types.

Another way Page Templates are sometimes used is to display entries from a Custom Post Type. So if your Theme or a Plugin adds a new Custom Post Type a Page Template may be available to display this to your users.

Example: Portfolio Page Template

An example could be an additional Portfolio post type. This could be used to record all your past projects. Your WordPress admin could now include a Portfolio section in the left hand admin menu, which you’d use to add, edit and delete your individual Portfolio items in much the same way as you do for Pages and Posts.

With some Portfolio items added we now need to be able to show these items to visitors. Our example Portfolio includes a Portfolio Page Template, so a regular Page is created then designated to show our Portfolio items by setting it to use our new Portfolio Template. Visitors to our Portfolio page will now see our Portfolio items instead of the usual content.

When Pages are used in this way, i.e. displaying a different Post Type, it’s best to think of the Page as a placeholder, just add the Page to your navigation menus just like any other Page.

Setting a Page to use a Page Template.

If you have some Templates available you’ll find them when editing a Page. Look for the Box titled Page Attributes and select your Template using the dropdown menu.

If you don’t see this box check the Screen Options and under Boxes make sure Page Attributes is checked.

Published on in Tutorials.