0

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.

4
  • What is reviews? It's important information that's missing from the question. Dec 30, 2020 at 7:11
  • @JacobPeattie It's a page, I created a page named "reviews".
    – Steve
    Dec 30, 2020 at 8:16
  • Have you got a custom post type named reviews? Dec 30, 2020 at 13:06
  • @JacobPeattie oh yes, I do. Damn, I didn't even think of that. What are my options then?
    – Steve
    Dec 31, 2020 at 3:56

1 Answer 1

0

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.

1
  • To reiterate, this is the correct solution to my problem. I apologize for taking a while to accept the answer.
    – Steve
    Jan 9, 2021 at 2:27

Your Answer

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

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