AnselTaft.com
Digital strategist, front end + email developer, WordPress enthusiast, IT tinkerer, and not-so-horrible writer

Custom Layouts for WordPress Themes

Have you ever wanted a homepage that looked different than your blog page? Or have you ever installed a theme that had different page templates for the homepage, gallery pages, contact form and blog post? I sure have. For months I wondered how I could do it for my own themes.

Well, the answer turns out to be surprisingly simple. It's literally four lines of code:

<?php
/*
Template Name: Snarfer
*/
?>

You can read more about it here: http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

Here's how I used this knowledge: while putting together a new site for a local san diego salon, I took the default layout file (page.php) and copied it with a new name (homepage.php). Then I added the lines of code above, except I changed the template name to ‘Homepage'. WhaBAM! A new template type to chose from when adding a new page. In the case of SuedeSalonSD.com, I only used the new template type once, for the homepage.

But as you can image, the possibilities are virtually endless!

Enjoy!

Leave a reply