xScape Templates Layout, Part 4: Customizing Templates

Previous tutorials on layout in xScape explained the structure of the layouts, how the templates are loaded and now is the time to see how to change default templates. There are two methods to do this and both have own uses, so what you decide on using, it depends on what you need done.

Default content templates for each theme is in templates/content folder. They are named according to the naming scheme of templates type from previous tutorial. So, for instance ‘home_standard.php‘ is default template used for the home page. Some themes have more than one home templates, and more than one of other templates type. List templates (list_standard.php) are used for all archives by default, Single templates for single posts and so on…

Templates usually follow similar CSS class patterns for every theme, so it’s easy to see what you need in there. Most templates are much simpler than normal WP templates because they are only for content, not whole page.

1. Direct Editing

Well, simplest way is to directly edit the template you need. Simply open the template you need and change whatever you need. All changes will be live as soon as you make them. Since I have already mentioned home_standard.php file, let’s say you want to remove meta elements for each post (author, date, category), to make that change, simply remove whole DIV block with post-meta class. Save the file and you are done.

But, there is a big drawback with this method. Next time you update the theme, your changes will be lost. You can mark this template for backup exception so that update will not touch it, and your changes will be safe. If the template in the update contains fixes, you will not get them because of that. More on the upgrade/update of the xScape theme is here.

2. Custom Templates

Better method do this is to make a copy of the template you want to change, copy of the template should go into templates/custom folder. So, if we want to make same change as with direct editing, make a copy of  ‘home_standard.php‘ file into templates/custom folder and rename it into ‘my_custom_home.php’. Edit copied file and again remove whole DIV block with post-meta class. Now, we need to tell to xScape to use this file. Open Layout Manager and open home.php template for edit. Than just change value for Custom to a template name you have just edited. All files in custom folder will be in this list, so name the files so that you can know which one is for what exactly. Image bellow shows the example editor.

Selecting custom template
Selecting custom template

This is always recommended method. But, be careful to name your custom templates properly and not end up using template you made for home page as a template for 404 page. Problem with this method is that you need to change layout manager to use it, but that is not a problem if you need one or two changes. If you end up changing many templates, it can take some time, but you will be sure that these customizations don’t interfere with default templates.

Comments

Leave a Reply