I created a custom folder (“/templates”) and I put all of my template files in the folder. instead of root (“/wp-content/themes/my-theme/”). It works fine.

Do I have to add some function for indicating “/templates/” folder as my templates folder?
Usually you put them on root, right?

It works fine now but I just wonder if there is anything I have to. I can’t find any information on wordpress codex.
I just installed WPML and All of templates pages are 404 now. I wonder if it(custom template folder location) causes this 404 pages. cuz woo-commerce pages are showing fine. wc is not in my template folder. it generated by plugin.

——– Additional

I created a template
www/wp-content/themes/my-theme/tpl-home.php

I named this file as a template page.

<?php
/*
Template Name: Home
*/
get_header(); ?>

And I moved templates files on www/wp-content/themes/my-theme/templates/tpl-home.php

It still works well. I have seen a lot of themes do like this.

Do I need to setup some function to indicated the folder?

2 s
2

As of WordPress 3.4 you can put your page templates in whatever direct subdirectory you need, it doesn’t sound like you can put them into sub-sub directories but I haven’t tested this.

I suggest storing templates into /page-templates/ folder as WordPress seems to recognize it. From WordPress Page Templates Entry:

WordPress recognizes the subfolder page-templates. Therefore, it’s a good idea to store your global page templates in this folder to help keep them organized.

Tags:

Leave a Reply

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