Working with page templates

As any other WordPress theme, xScape Theme Framework based themes can use page templates. Number of templates is already included with every theme (archive, twitter, sitemap…), but adding new templates is also easy to do and customize the way you need it.

Before we continue, I recommend that you go through other tutorials about layouts and layout manager to understand how the templates are used: xScape Theme Framework Layouts Manager Tutorials. Now, this tutorial is step by step information on how to work with custom page templates.

Create New Template
Create New Template

1. Create new template

Open the Layout Manager, and on the first Templates tab click Add Template button. Set source to Custom Template, and enter the template name (let’s say – My New Template). File name you can leave empty, framework will generate it based on the name. If you give it a name here, don’t include extension.

Once that is done, new template will be added. At the end of templates list, you will see new one called: tpl-my-new-template.php. In the same time, a new content file for this template is added into templates/custom folder, and this content file has same name as the main template file. This file is empty and into this file you can add content for your template.

2. Edit template layout

Well, this is done as with any other template. Click on the edit button (green checkbox icon in the templates list), and template will be opened for editing. But, here you need to make another small change. There are 4 drop down boxes. First you need to sort out the Content one. It is set to Standard, and that will cause for this new template to load normal page template content. Switch this to Custom Template. Now, you need to select custom template to use from the Custom drop box. All templates from templates/custom are listed in this drop box. Find the one named tpl-my-new-template.php and select it.

If you want, switch Layout drop box to Custom, and layout manager will show layout blocks you can handle as with any other template to disable sidebars, or set things up, or whatever else you might need.

3. Edit template content

Now you need to write the custom content for your custom template. Open tpl-my-new-template.php from templates/custom folder to edit, and enter any content you need there. Make sure you include actual content, don’t add header, footer or sidebar elements, that will be done by the Framework. Great thing about this, is that any other theme template can be set to use this custom template content, just set the template you want to Custom Template and select template from the Custom list.

Comments

Leave a Reply