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

Template Name: Portfolio template column four simran
  • 1
    So far everything you described should be working just fine. Any more details you can think of and provide? Maybe code of your template (leave unimportant parts out if there is a lot of it) ?
    – Rarst
    Oct 26, 2012 at 22:19
  • Can you add the (basic) code for that loop? It might be where your problem is.
    – Jen
    Oct 28, 2012 at 5:59
  • Added the code for the portfolio_loop.php file, it was a theme i purchased from themeforest so i dont know much about its coding stuff Oct 29, 2012 at 7:19

1 Answer 1


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.

  • No i tried setting permalinks many times, but strangely these page templates are working fine on my WAMP server installation Oct 29, 2012 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.