winkm89/teachPress

problem moving template folder

Closed this issue · 2 comments

-- ISSUE:
Cannot use a new template or move the template path.

-- USAGE
I'm using Page Builder by SiteOrigin to make the layout of my page, adding a custom HTML with the teachpress shortcode.

-- STEPS
It seems that the FAQ is not up-to-date w.r.t. the latest version of teachpress. As per the FAQ, instead of changing the path at wp-content/plugins/teachpress/teachpress.php, the constants section is now at wp-content/plugins/teachpress/core/constants.php:

define('TEACHPRESS_TEMPLATE_PATH', TEACHPRESS_GLOBAL_PATH . 'templates/');}

where I added the new path to store the templates and copied all templates to the new path.

-- EFFECTS

  1. This change doesn't have any effect in the publication list, but crashes Page Builder when trying to edit the corresponding page and I'm unable to edit it anymore.

  2. The same issue happens if I add any new file to the original templates folder.

  3. A critical error in WP happens in case the text editor is used instead of Page Builder. It seems a more broad issue affecting beyond Page Builder.

-- SOLUTION
I can only resolve it if I move TEACHPRESS_TEMPLATE_PATH back to the original location and remove any other files in the templates folder.

-- POSSIBLE REASON FOR THE ISSUE
I guess that the pages cannot be edited by WP if either a new template or a new path is used, since the pages remain unaffected with the template (2016 or 2021) used before the changes are implemented. It seems that teachpress is blocking changes in the template files/path, or there is a issue with WP.

-- QUESTION
Given that the FAQ seems to not be based in the current version of teachpress, is there any other step to be followed in order to move the template path or use a customised template?

Hi,
I think the problem is more a wrong configuration of the TEACHPRESS_TEMPLATE_PATH and TEACHPRESS_TEMPLATE_URL: If the plugin can't find the new directory, this can lead to some bigger problems like a broken Page Builder.

Yes the constants were moved to an own file, but that's not the place where you should edit the constants. As I wrote in the FAQ you should edit it in the wp-config.php or at the beginning of the teachpress.php (after the beginning of /* Includes */ part at line 41).

If you want to use a custom template I recommend to copy it to the default template folder firstly and change this template folder if your custom template is complete. And don't forget to edit your shortcode, if you want to use your custom template: https://github.com/winkm89/teachPress/wiki/Creating-templates#using-the-new-template Otherwise you won't see any difference ;)

Thanks for your feedback. Indeed, I managed to make it work after correcting a mistake: I was placing the templates directly in wp-content/uploads/ instead of a folder teachpress/templates inside uploads. I believed it was a major problem because of the effects on PageBuilder for a simple tag in a shortcode :)