-
I wanted to have a page at /contact/ which does not use the contact template included with the theme, but no matter what template I chose for that page, it kept using the contact one. Turns out to be a very simple cause, but it took me a good while to realize what was going on. According to WordPress’s template hierarchy, page-{slug}.php will be applied to any page with a matching slug. So if page-contact.php exists, a page with its slug set to ‘contact’ will always use that file.
I know I can just rename the file, but I prefer making all modifications to the child theme. For now, I will copy the default page template to the child theme, and name it page-contact.php.
So I’ve got it sorted, but I thought it was something you should know about. What I’ve seen other theme developers do to avoid this conflict is to use ‘template’ instead of ‘page’ in their file name. So in this example, the file would be named template-contact.php.
-
HB-Themes support team typically replies to all topics within 48 hours except on weekends and public holidays. You must register to post topics.
Forum Categories
- Highend WP Theme 25,647
- Aegaeus WP Theme 1,616
- Requests and Feedback 133