404 on child page template

I have a page called portfolio and I have created several child pages for it like Video page, audio page etc …

I also created custom page template for portfolio and named its file portfolio-template-ahsan.php. But when I use it on my child page as a custom template, it gives me the 404 error page.

Now what I am confused about is how this naming convention works, and how should I name the child custom page templates, if I remove the Parent page from Video page, then the template works fine, but when I use Portfolio page as parent page, it gives me 404 error

here is the code for the inner page template, could it be a problem if the parent page have different template and child page have different page template

?php 
    /* 
Template Name: Portfolio template column four simran
*/
?
?php
get_header('ajax'); 
include('portfolio_loop.php');
get_footer(); 
?

Topic child-pages template-hierarchy 404-error theme-development Wordpress

Category Web


If you're working with custom post types and keep getting 404 errors, you often just need to re-save your site's permalinks under Settings > Permalinks. Try that and let me know if it works.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.