How to Create Custom Single Template in WordPress

Prem Tiwari - - WordPress, WordPress Snippets


I got some tutorial request for “How to Create a Custom single template for a specific category in WordPress” from my blog readers so that I am creating a separate tutorial for this request.

If you are looking to create a custom single page template for a specific WordPress category on your blog or website, keep your close attention in this post as I am going to share how to create custom single templates for a specific category.

How to Create Custom Single Template For a Specific Category in WordPress

How to Create Custom Single Template in WordPress

Follow the below steps to create a custom single templates in your WordPress blogs.

Step 1) Create or copy content-single.php and create a new file. eg: content-yourCategory.php

Step 2) Open single.php and replace this get_template_part(‘content’,’single’); by the following code:

Note: The parameter “yourCategory” can be your Category ID, Category Title, Category Slug or Array of IDs, names, and slugs.

Over to You

Hope this tutorial help you to create a custom single post template in your WordPress blog. Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials.


Prem Tiwari

Prem Tiwari is the founder of FreeWebMentor.com and also a professional developer and a blogger by hobby.

Tags: , , , , , , , ,

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.