0

I have archive-teachers.php which is not yet inside any folder and it was working fine. But when I transfer the archive-teachers.php in the archive folder, it stop working everytime I check the url /teachers/. So I put back the archive-teachers.php back together with the header.php. Then I created a parent of the teachers which have the url school/teachers/ but now the archive-teachers.php is not working anymore. Before, I just create a blank page named Teachers and it was able to call the archive-teachers but when I create a parent page of teachers, it stopped working.

I would like to ask help with you guys on how can I solve my problem. First, will be able to use the archive-teachers.php inside a folder and second, how can I call or access the archive-teachers.php inside the folder in the url of /school/teachers/

Please give some advise.

1

That a normal behaviour of WordPress.

Have a look to te template hierarchy template hierarchy. To solve your matter, leave your file in the main folder of your theme (or child theme) or use a template_redirect or template_include filter, depending how you want to call your archive page, you'll be able to redirect to another template file or include the file you want.

For instance, archive folder is not a folder that WordPress will detect when it want to load a template, you need to tell to WordPress, where is the file you want to load for your special query.

5
  • Thank you for the quick reply. Okay I leave my file archive-teachers.php in the main folder of my theme. Now, my problem on how can i use the archive-teachers.php in the url /school/teachers. can you give me some sample codes, please? – Joffrey Oct 13 '16 at 10:21
  • did you try to manage it in the permalink settings panel ? You maybe need to modify your rewrite rule too, if "school" is not a taxonomy or something recognize by the wp query. – Benoti Oct 13 '16 at 10:28
  • the school and teachers will be a page and if i want to view the teachers page which will have the url /shool/teachers , it will use the archive-teachers.php. i still cant figure out how. i tried changing the permalink but it seems that it didnt work or problem im doing it work – Joffrey Oct 13 '16 at 10:43
  • so try a name like archive-shool-teacher.php where school is the taxonomy category name of teacher. archive-{taxonomy}-{term}.php – Benoti Oct 13 '16 at 11:00
  • thank you for trying to help me. it was a great learning experience. I was able to solve my problem now. thanks to you all – Joffrey Oct 14 '16 at 5:07

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.