I was working on a template customizing it according to my need. I wanted a different look for my posts for Pictures and Galleries. I wanted to show these pages without sidebar and some changes in the page width for these pages. Its very easy to avoid the sidebar, but the page width should also be different so I needed to do some work on this.
In the single.php or the index.php depending on the template.
<?php
$picpost = false;
$galpost = false;
foreach((get_the_category()) as $category) {
if($category->cat_ID==4) {
$picpost=true;
}
else if($category->cat_ID==26) {
$galpost = true;
}
}
?>
<?php
if($picpost) {
include(TEMPLATEPATH."/picture-post.php");
}
else if ($galpost){
include(TEMPLATEPATH."/gallery-post.php");
}
else {
?>
This will check for the category and include the right template page.
The template shown above is the same template (Revolution Theme) which I am using on this page. I have used some images from different templates to create this template.
{ 2 trackbacks }
{ 1 comment }
Very Interesting and very useful. Thanks for sharing
Comments on this entry are closed.