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. Required fields are marked *

Most Popular Posts

How to create zoho leads using PHP?

Posted on 3 years ago

Bhumi

How to set 301 Redirection in PHP

Posted on 3 years ago

Bhumi

The Reader’s Poll – June 2015

Posted on 2 years ago

Bhumi

The Reader’s Poll – August 2014

Posted on 3 years ago

Bhumi

The Reader’s Poll – June 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – May 2014

Posted on 4 years ago

Bhumi

The Readers’ Poll – August 2013

Posted on 4 years ago

Bhumi