Skip to content

Fix course item templates with custom course layouts - #637

Open
mauropereiira wants to merge 1 commit into
LearnPress:developfrom
mauropereiira:fix/custom-course-item-template
Open

Fix course item templates with custom course layouts#637
mauropereiira wants to merge 1 commit into
LearnPress:developfrom
mauropereiira:fix/custom-course-item-template

Conversation

@mauropereiira

Copy link
Copy Markdown

What changed

Clear competing block-template candidates after LearnPress confirms that the request is for a course item. The existing SingleCourseItemBlockTemplate is then the only candidate for lesson and quiz routes.

Why

A course-level custom template appears first in WordPress's single-template hierarchy. LearnPress previously appended its item template without removing that higher-priority course template, so lesson and quiz URLs rendered the course overview. LearnPress still added course-item-popup, leaving the page unable to scroll normally.

Course overview requests do not enter this branch, so their assigned custom templates remain unchanged. Custom single-lp_course_item templates are still loaded into the item template before it is appended.

Closes #636

Testing

Tested with WordPress 7.0.3, LearnPress 4.4.4, PHP 8.4, Assembler 0.0.29, and Twenty Twenty-Five 1.5.

Theme Assigned course template Lesson/quiz before Lesson/quiz after
Assembler Default Works Works
Assembler Custom Course overview renders; page cannot scroll Course item renders
Twenty Twenty-Five Default Works Works
Twenty Twenty-Five Custom Course overview renders; page cannot scroll Course item renders

Also verified:

  • Logged-in and logged-out requests.
  • Course overview keeps its assigned custom template.
  • Custom Single Course Item template still renders.
  • phpcs --standard=phpcs.xml inc/Gutenberg/GutenbergHandleMain.php
  • php -l inc/Gutenberg/GutenbergHandleMain.php
  • git diff --check

The full PHPUnit suite was attempted on the current develop branch but does not complete because existing tests reference missing subscription files and later redeclare learn_press_get_order().

@tungnxt89

Copy link
Copy Markdown
Collaborator

Hi mauropereiira,

Thank you for sharing your feedback. Our team is currently investigating the issue, and we will update you as soon as it is resolved.

Kind regards!

@tungnxt89

Copy link
Copy Markdown
Collaborator

Hi @mauropereiira ,

Thank you for your feedback. We have fixed this issue in version 4.4.5. Please update your plugin, check if everything works properly, and let us know if you need any further assistance.

Best regards,
Thimpress

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

Successfully merging this pull request may close these issues.

Custom course templates override lesson and quiz templates

2 participants