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?

3

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

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.