0

I'm creating a template with a few templates with names page-contact.php, page-portfolio.php and page-blog.php.

The problem is that when I select a Defaul Template for a page (I expect it to open page.php) and rename the page permalink to sitename.com/contact the page starts using the page-contact.php..

Why is that, why is the URL telling WordPress what template to use if a Default one i chosen? Is this intended behavior?

1 Answer 1

4

Yes, this is the intended behaviour:

page-{slug}.php - If the page slug is recent-news, WordPress will look to use page-recent-news.php

So, simply use a different filename for your templates, like template-contact.php for example. You can find more info about this here:

https://codex.wordpress.org/Template_Hierarchy

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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