Created
October 8, 2011 11:04
-
-
Save sideshowcoder/1272148 to your computer and use it in GitHub Desktop.
Wordpress Single PHP theme based on category
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Single News | |
*/ | |
?> | |
<?php | |
// Switching if projects or if news | |
$proj='projects'; | |
$catid=-1; | |
foreach(get_categories() as $category) | |
{ | |
if($category->name==$proj or $category->slug==$proj) | |
{ | |
$catid = $category->cat_ID; | |
break; | |
} | |
} | |
if (in_category($catid) && $catid!=-1) | |
{ | |
include (TEMPLATEPATH . '/single-projects.php'); | |
} | |
else | |
{ | |
include (TEMPLATEPATH . '/single-news.php'); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment