I was developing a site for a client who wanted to show the post in a different template depending on it’s category. We all know that you can easily have different templates for pages using the following code at the top of your page template:
<?php
/*
Template Name: The Template Name
*/
?>
But this doesn’t work for posts. However there is a way to do it, I give to you the ‘Single Post Template Plugin’. Much like when you select a template for a page when you create it, this plugin allows you do do the same for a post.
Similarly to a page template you have a small bit of PHP code at the top of you template that gives it it’s name:
<?php
/*
Single Post Template: The Template Name
Description: Optional
*/
?>
So to use this plugin do the following:
- Download and activate the plugin
- create your templates, adding the above code to the top of the template
- when creating the post select your template from the ‘Single Post Template’ box.
Thats it… You should now have different templates avalaible for your posts.
Hope this helps you out, please leave comments or questions.
Alex



