Back to Top

How to use Parent Category Template for child in WordPress?

To use Parent Category Template for child in Wordpress

Here, is the new article about WordPress. This article is about to explain how to use parent category template for child category in WordPress.

So, In this short tutorial, we will see the function which will make a subcategory follow the template of its parent means to use parent category template while viewing for all child categories. Because it is quite complicated to create a separate template file every time you create a new Subcategory or category and it’s not good to create the template file for each and every category.

Read: Cookie Free domain in WordPress and WordPress Multisite Explained

You need to copy and paste following line of code into your theme’s function.php file

Above function will check if category’s own template not exists, will check for parent category template and will display parent category’s template.

I hope that you liked this simple technique and helps someone.

Don’t hesitate to use this code in your WordPress projects and post your comments if you need help. As always, thanks for reading. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Leave a Reply

Your email address will not be published.

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

Most Popular Posts

How to use Interface in PHP

Posted on 12 years ago

Bhumi