I’m working on my first wordpress site, and moving it online. I have been adding some extra templates to design a simple booking engine, that was working perfectly on my offline localhost server.
However, I’ve been having trouble with getting these templates and other .php-files to work on the live website. It seems that using a specific path to locate the template or file doesn’t work;
include() can only load the template/file when it is in the same folder.
For example, I have a page template called ‘Bevestigingstemplate.php’ in my Child-theme’s folder (Theme-child), that I activated on one of my web pages. In this template, I want to call a file called ‘bevestiging.php’, that’s located in Theme-child/modules/content.
However, if I call
include('modules/content/bevestiging'), it fails and I get a broken page.
If however I move ‘bevestiging.php’ directly into my Child-theme’s folder and call
get_template_part('bevestiging'), it works like a charm.
Now I don’t want to end up with a chaotic list of templates and sub-templates in my Child-theme folder, so I’m desperately looking for a way to fix this. I’ve read somewhere that I should maybe add a config.php file in my Child-theme’s folder that defines a ‘root’, but I couldn’t find a clear walkthrough and was hoping to maybe fix it in an easier way, or at least first to understand where I’m going wrong here.
Any advice on how to proceed is welcomed warmly. Thanks!
Below is the code I use in Bevestigingstemplate.php (basically just copied page.php from main theme).
- Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
- Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
- Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.