Issue: The root index.php file is showing up instead of my created template-name.php.
What I have done to try and fix: Delete and create a new reviews page with the routename of “reviews”. Check my template-page.php to see if I forgot something.
Changed the template to the default template for the reviews page and it gives the same index.php.
Other Important Info:
I have a development environment where the routename works (www.developmentsite.test/reviews), and shows my template-page.
I have also created a page, with a different route, on my production site that uses the review template-page I created and works as well(www.productionsite.com/test-page).
What I need help with: I need (www.productionsite.com/reviews) to show my template-page that I created.
What I think is the issue: There is something wrong with the routename /reviews because even creating a brand new page with that routename, it gives me the index.php root file while using any other routenames, it gives me my default page.php file.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
In your comment you mentioned that you had a reviews post type. This means that /reviews/ will be the default URL for listing that post type, and this will use index.php as per the template hierarchy. If you’re trying to list reviews, then my first suggestion would be to just use the post type archive, and create archive-reviews.php to markup and style them.
If you do ultimately need a static page that list reviews, rather than the post type archive, then set the has_archive property of the post type to false. Then /reviews/ won’t exist anymore, and you can use it as the slug for a new page instead.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0