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

Fixes #3307: Removes empty lessons section & title from single course page. #3308

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

hansschuijff
Copy link
Contributor

Fixes #3307

Changes proposed in this Pull Request

  • Remove empty lessons html from single course page
  • In the process moves actions 'sensei_single_course_lessons_before' and 'sensei_single_course_lessons_after' outside of the course-lessons section, so the section can be dependent on post having been found.
  • In Sensei LMS the above actions seem only to be used for for setting up and resetting the query and some globals, so moving them outside the section should be possible.

Testing instructions

  • Works on single course page ( /course/{course-slug}/ ) and a page using the [sensei_course_page] shortcode.

@donnapep
Copy link
Collaborator

donnapep commented Oct 14, 2020

On the single course page for unsupported themes like Divi (themes that don't explicitly declare support for Sensei LMS or for which we don't have a custom integration), there's an empty <header><h1> element:

Screen Shot 2020-10-14 at 1 43 55 PM

On supported themes like Storefront, that element contains the course title:

Screen Shot 2020-10-14 at 1 45 39 PM

Does it seem possible to remove the empty <header> tag for unsupported themes as well?

@donnapep donnapep added the [Status] Needs Author Reply Requires response from the author label Oct 14, 2020
@hansschuijff
Copy link
Contributor Author

@donnapep I'll see what I can do. It's been a while, so I have to recall first what I have done here. I'll let you know.

Changed all the_title() methods
so it only renders a <header> or <h1> tag
when they are not empty.
@hansschuijff
Copy link
Contributor Author

@donnapep I've added a condition to the_title() so the header/h1 is only inserted when the title is not empty. Since I found the same problem was also present in the_title() for lessons, I have performed the same edit in all 4 the_title() methods (course, lesson, quiz and message). In all cases the header block is only inserted when there is content in it. It seems to work like this.

@donnapep donnapep removed the [Status] Needs Author Reply Requires response from the author label Oct 15, 2020
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.

Don't generate html for empty title and lessons section on single course page
2 participants