How to assign different templates for post detail page of different categories?


Jun 07 2012
blog-image
admin Wordpress Wordpress Plugins 0 Comments

Hello Friends !! Since a long 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 will be very helpful 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, go to single.php file which shows you full article.

After header, write below code:

 

Where ‘9’,’10’ is category id.

You can create as many templates as you want. You can also create multiple headers like this and include like asame 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get News In Your Inbox

Name
Email *

Popular Blogs

recent-blog-image
How to create callback functions for jQuery plugins & extensions?

Most of the time custom jQuery plugins and extensions that we create do not use callback functions. They usually simply work on DOM elements or do some calculations. But there…

Continue Reading
recent-blog-image
Top 5 Best Ecommerce plugins in WordPress

Nowadays online shopping has increased and become very convenient shopping place for users, you may be wanting to start your own online shop so you can unleash your products to…

Continue Reading
recent-blog-image
10 Best WordPress Live Chat Plugins for Customer Support

The Live chat is the common thing now days, if you own any eCommerce website or if you are the service provider. It makes easy for your customers to contact…

Continue Reading
recent-blog-image
Free plagiarism checker sites

Plagiarism is the process of taking someone’s ideas & work and passing them off as one’s own. Prevent Plagiarism to check originality of content is the most important factor for…

Continue Reading
recent-blog-image
How to show wordpress posts in other CMS?

Currently since from few weeks, I am working on Expression Engine. Now you thought that what is Expression Engine. Now let me explain you in little brief. Expression Engine is…

Continue Reading

Remarkable Facts About Us

0 %
Client satisfaction
0 +
Years of Experience
0 +
Happy Clients
+
Projects Accomplished

Ready to Get Started ?