0

I'm having a strange issue with a page. The site has a Default Template (page.php) and several custom templates. A page was created using a custom template (page-services.php), but then later switched to use the Default Template (all via Admin Page Attributes). However, the page's front end continues to pull the custom template instead of the selected Defaul Template.

The back end is correct (there are different custom fields depending on the template). The edit page view shows the correct custom fields for the template selected.

I can't think of any other details that might be relevant.

0

Refer to the Template Hierarchy to help understand what's going on here.

When you create a custom page template, it is identified as such by the header within the file, not by filename. But you've also named the file following the page-{slug}.php format, and as you can see in the Template Hierarchy, WordPress looks for the template named page-services.php for a page with slug services, if no custom template is assigned. In your case, they're the same file.

Rename your custom page template file so it doesn't clash with other template naming formats and this problem will disappear.

  • Thank you! All this time, and I've totally missed the page-slug part of the template hierarchy! (That's what it was — the slug was re-named to services, same name as the template file). – StudioAl Sep 10 '13 at 23:44

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.