glenatron
Forum Replies Created
-
Looking at this locally the first (but not only) problem I am getting flagged is that it looks like the
resolve_block_templatefunction inwp-includes/block-template.phpis looking to sort templates by slug, based on the file names and it appears to simply not be recognising any of the Gutenify files.I have the same theme installed (and all the same plug-ins) on my local machine when I was trying to track down this problem and it works correctly for me, too. This suggests it’s a weird bug on that specific machine but it was not cleared by completely uninstalling and reinstalling Learnpress and it is resolved by removing that template (creating a new file that contains the same data makes the problem show up again so it’s not a problem with that specific file being corrupted) – I’m mostly raising this as a bug report because I can’t tell at all why it happens, but I have managed to narrow down the cause.
My guess would be that for some reason it is loading the file but discarding the contents completely rather than parsing them. It seems that by removing the file it falls back to the PHP templates instead of using the HTML ones.
We are using Gutenify Business Dark – switching the Use Gutenberg checkbox on courses made no difference to the problem.
Alright, having gone into great depth here, it seemed as though the
learnpress/contentblock was never being seen by WordPress on this page. Although there is no apparent problem with the file and no errors reported, it seems as though if I removewp-content/plugins/learnpress/block-templates/single-lp_course.htmlit works again. I have no idea what is different about the file – when I copy the content to my local version it works fine, but on the live server it causes LearnPress to lose the courses altogether.Not a real fix because I don’t know why this happened, but if anyone else finds themselves in the same boat, that seems to have caused the problem for me.
I have found that on the course page
LP_Block_Template_Controller->register_block_template_post_type()is definitely called butrender_content_block_template(the callback from that registration) is never called on this page. On other pages it seems to be fine. The consequence being that no Learnpress templates are rendered at all on the content page.Things I have eliminated:
- Permalinks – the suggestion above did not change things.
- Theme (local copy with the same theme works correctly)
- Plugins (local copy with the same plugins works correctly)
- Learnpress custom theme changes (disabling ‘learnpress/overrid-templates’ does not change anything)
- Removing and reinstalling Learnpress made no difference – it wasn’t a full uninstall as the content was still there, so I assume the database tables were left behind.
No Learnpress templates seem to be loaded on the single course page at all, it looks as though WordPress is just loading it as a regular post rather than applying any of the Learnpress hooks, but those are applied on the course listing page.
Comparing this deployment with a local WordPress/Learnpress deployment I can see that the
content-single-coursetemplate is being loaded locally and it is not being loaded on the live server.Adding a simple
echo("<p>Learnpress template: ".basename(__FILE__, ".php")."</p>");to every file in mymy-theme/learnpress/folder does not seem to show anything up on the course details page. I can see the echo statements in the list of courses, but when I click through to the course detail page it still only shows the text of the summary. It seems as though it is simply not recognising it as a Learnpress course, although in MySQL it shows thepost-typeaslp_course– is there a way that can happen?- This reply was modified 3 years, 8 months ago by glenatron.
I have changed that and it doesn’t seem to have made a difference.
I have tried adding a lot of debugging to the various LearnPress classes and I can see where it identifies the post, but there’s nothing even requesting the sidebar template at any point.
I tried uninstalling and reinstalling LearnPress but that didn’t change anything. Disabling ‘learnpress/override-templates’ does not change anything. I could really use some help here because it’s clear something has caused the sidebar to be removed on the course detail page, but I cannot figure out what is causing it.
The only other change that has happened around the time that the courses stopped working (I foolishly didn’t check after the last version update so I can’t say whether or not that caused the problem) was that we changed URL for the site- there’s nothing referencing the site url in the Learnpress configuration, but could that cause it not to show the sidebar for some reason?