Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom path template loading fails when using overridden templates #1481

Open
rajaeinet opened this issue Dec 22, 2024 · 0 comments
Open

Custom path template loading fails when using overridden templates #1481

rajaeinet opened this issue Dec 22, 2024 · 0 comments

Comments

@rajaeinet
Copy link

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 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant