开发者

Assign template to descendant category pages in wordpress - but not parent category page

I've got a Wordpress structure like this.

HOME

HOME > BLOGS

HOME > BLOGS > BLOGNAME1 > SINGLE PAGES

HOME > BLOGS > BLOGNAME2 > SINGLE PAGES

HOME > BLOGS > BLOGNAME3 > SINGLE PAGES

I'd like the BLOGNAME1, BLOGNAME2, BLOGNAME3 category pages to use the same template.

From what I can tell, I'm after something to put in functions.php that s开发者_运维知识库ays if category is a descendant of the BLOGS category, its category page should use a particular template.

There are some similar discussions here but they'd all force these subcategories to inherit the BLOGS template, which isn't what I'm after.

Any ideas?


Use the Category Template Hierarchy Plugin I built. Then just create your template and name it according to the plugin's naming convention. In your case...

child-of-category-blogs.php

..that is, if your slug for that category is blogs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜