Aug 11, 2010
admin

WordPress Magic- Different post page for different category post

Hello Friends !! Since last many time, I am working with wordpress and I got lot of challenges with wordpress customization.

Recently, I have a confusion that how can I make different single.php file for different posts ? After long research, I got a solution of this problem.

You can create as many single.php files as you want and you also can apply it to different posts. For example, In your site News section has a different layout then blog posts. At that time, this post helps to you .

Here I give you example that how you can do this.

First , create one file called single-categoryID.php in theme folder.

After creating this please go to single.php, file which shows you full article.

for more details click below:

After header, write below code:

if (in_category(’9′))
{
include (TEMPLATEPATH . ‘/single-9.php’);
}
elseif (in_category(’10′))
{
include (TEMPLATEPATH . ‘/single-10.php’);
}
else
{
rest of the code…….
}

You can create as many templates as you want. You can also create multiple headers like this and include like a\same above code.

Thats It !! Enjoy different template for different posts.

If you have any wordpress customization query or any confusion, feel free to ask me or comment me.

Thanks,

  • http://www.programmingfacts.com Rakshit Patel

    Really useful. Thanks a lot.

  • phpgenious

    Thanks Rakshit.
    Keep commenting.

PHP Genious Services

I am a PHP freelancer india, PHP Developer india, PHP programmer india, Wordpress Freelancer india, Wordpress customization services, Wordpress Plugin Developer, Wordpress theme customization, Wordpress plugin customization, Magento Freelancer, Magento Developer india, Magento customization services, Magento theme integration, Opencart Developer india, Zencart Freelancer, Opencart customization, Opencart plugin development, HTML and CSS customization, cakePHP Developer, cakePHP Freelancer india, Ecommerce Developer india

Click Here for

Follow me on Facebook

Categories

Get Adobe Flash playerPlugin by wpburn.com wordpress themes