• Resolved glenatron

    (@glenatron)


    I’ve done a bit of restyling to get Learnpress working with our theme and it was all working correctly until the latest update. Now the course list looks fine, but when I click through to a course summary the page only shows the summary from the course- there is none of the detailed course information on the page, only the text of the summary.

    I am very aware this could be a result of my customisations (as recommended I have copied across the templates folder to my theme and edited it there) but when I run a diff between the templates folder in the plug-in and the templates folder in my theme I can’t see any differences that would obviously explain the problem. Also when I rename /themes/my-theme/learnpress (which I assume will cause it to revert to the plug-in version of the files) I still have the same problem.

    I think this happened after updating to 4.1.7.1 but it’s hard to be certain, it was definitely around the time that I installed that update.

    I have enabled the “Debug Mode” checkbox in Settings > Advanced, but I can’t find an explanation for what that does. When I view the page with WP_DEBUG enabled I only get deprecation warnings, no sign of any errors.

    I’m experienced with WordPress and PHP so I should be able to find more detailed diagnostics if I know where to look and if anyone can point me at which files might be causing this problem I will probably be able to figure it out for myself. Right now I’m having trouble figuring out which template, or combination of templates, I’m looking at for the course summary page.

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter glenatron

    (@glenatron)

    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?

    Plugin Author ThimPress

    (@thimpress)

    Hi glenatron,

    LP require set permalink option to ‘Post name’. Please set that first.

    Thanks.

    Thread Starter glenatron

    (@glenatron)

    I have changed that and it doesn’t seem to have made a difference.

    Thread Starter glenatron

    (@glenatron)

    Adding a simple echo("<p>Learnpress template: ".basename(__FILE__, ".php")."</p>"); to every file in my my-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 the post-type as lp_course – is there a way that can happen?

    • This reply was modified 3 years, 8 months ago by glenatron.
    Thread Starter glenatron

    (@glenatron)

    Comparing this deployment with a local WordPress/Learnpress deployment I can see that the content-single-course template is being loaded locally and it is not being loaded on the live server.

    Thread Starter glenatron

    (@glenatron)

    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.

    Thread Starter glenatron

    (@glenatron)

    I have found that on the course page LP_Block_Template_Controller->register_block_template_post_type() is definitely called but render_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.

    Thread Starter glenatron

    (@glenatron)

    Alright, having gone into great depth here, it seemed as though the learnpress/content block 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 remove wp-content/plugins/learnpress/block-templates/single-lp_course.html it 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.

    Plugin Author ThimPress

    (@thimpress)

    Hi glenatron,

    That file is used for the Gutenberg theme.

    Did your theme use Gutenberg? Please send us a link to install the theme on the WordPress theme.

    Thanks.

    Thread Starter glenatron

    (@glenatron)

    We are using Gutenify Business Dark – switching the Use Gutenberg checkbox on courses made no difference to the problem.

    Plugin Author ThimPress

    (@thimpress)

    Hi glenatron,

    Yes, We’ll check that theme and reply to you when have done.

    Did you try using the default theme WP 2022? We use it to see the course detail shown normally.

    Thanks.

    Plugin Author ThimPress

    (@thimpress)

    Hi glenatron,

    We test with the theme ‘Gutenify Business Dark’ see display course detail normally like the image

    Thanks.

    Thread Starter glenatron

    (@glenatron)

    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.

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Learnpress course detail sidebar missing’ is closed to new replies.