For example I have in my theme folder named test-pages with some php web pages that display different message, in some part of process I want to pull with file_get_contents to get content of one page from that folder, but I can’t do it, it just doesn’t work, when I try to access directly to that page, I get 404 message like that pages doesn’t exists.

How can I make this page visible to WordPress, so I can access it without getting 404?

Hope you understand me.

2 Answers
2

Move the template files out of the subdirectory, and put them in the Theme’s root directory. Then, if you simply want to include the contents of those template files in other template files, simply call get_template_part( 'test-page-name.php' );.

If you insist on keeping these files in a subdirectory, you’ll need to include them via locate_template().

Leave a Reply

Your email address will not be published. Required fields are marked *