wordpresswordpress-themingcustom-wordpress-pages

Wordpress nested (child) page with custom template


I want to achieve that I can have this url structure for the page '/category/{specific-category)'. So I created category as parent page and then the specific category page as nested page.

I created a custom template file. I can select it in page attributes on the page. However whenever I select the custom template on a page which has a parent page selected it keeps defaulting to index.php even though it stays selected. Whenever I deselect the parent page for it, it does use the custom template.

Why does this happen and how can I achieve what I want?


Solution

  • The problem was using the reserved "category". It was confused and thought it needed to load the category template instead of the custom. I changed "category" to "categories" and now assigning templates on the child pages does actually work.

    For others coming across this problem: Always check reserved words to avoid these kind of issues.