Hi
We are experiencing loading errors when using template overrides for some pages!
I believe this issue is caused by functions such as tutor_load_template_from_custom_path(), which determine the target file path using the __DIR__ constant.
In such cases, if a template containing these functions (that rely on __DIR__) is overridden, the sub-template paths are resolved relative to the child theme template instead of the plugin directory. As a result, if the sub-template files are not also overridden, loading errors occur.
On the contrary, , when a template loaded using __DIR__ is overridden, the overridden template does not take effect. For example:
If the single-content-loader.php template is overridden, all associated templates—
single-lesson.php
single-assignment.php
single-preview-lesson.php
single-quiz.php
must also be copied into the child theme directory without any changes.
The following code demonstrates that single-content-loader.php is being loaded from the plugin's template directory rather than the child theme directory:
|
tutor_load_template_from_custom_path( __DIR__ . '/single-content-loader.php', array( 'context' => 'lesson' ), false ); |
Hi
We are experiencing loading errors when using template overrides for some pages!
I believe this issue is caused by functions such as
tutor_load_template_from_custom_path(), which determine the target file path using the__DIR__constant.In such cases, if a template containing these functions (that rely on
__DIR__) is overridden, the sub-template paths are resolved relative to the child theme template instead of the plugin directory. As a result, if the sub-template files are not also overridden, loading errors occur.On the contrary, , when a template loaded using
__DIR__is overridden, the overridden template does not take effect. For example:If the
single-content-loader.phptemplate is overridden, all associated templates—single-lesson.phpsingle-assignment.phpsingle-preview-lesson.phpsingle-quiz.phpmust also be copied into the child theme directory without any changes.
The following code demonstrates that
single-content-loader.phpis being loaded from the plugin's template directory rather than the child theme directory:tutor/templates/single-lesson.php
Line 11 in 7015253