• Resolved neo1664

    (@neo1664)


    Hi,

    I need to start creating a lot of new lessons, but I do not need half the blocks that are automatically added when creating a new lesson. Is there a way I can create a new template, or modify the existing one to remove/add the blocks I do want so that I don’t have to remove them each time?

    Thanks,

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Deric (a11n)

    (@dericleeyy)

    Hi @neo1664 ,

    Sensei 3.9 introduced filters to customize the default block template for lessons:
    https://automattic.github.io/sensei/sensei_lesson_block_template.html

    However, we do not have any guide or example at the moment on how to use this filter.

    Alternately, you could also create a lesson with your desired blocks and duplicate them in wp-admin > Sensei> Lessons. Then customize them to be relevant to each lesson.

    Hope this helps!

    Thread Starter neo1664

    (@neo1664)

    Hi @dericleeyy,

    Thanks for the reply. I had already tried the second option you suggested, but this still added all of the blocks after duplicating it? So I don’t know if that’s intentional or not?

    But I will give the first option a bash and report back. Thanks.

    Plugin Support Deric (a11n)

    (@dericleeyy)

    I stand corrected. The quiz block is recreated even in a duplicate.
    In a new lesson, the default blocks are Lesson Properties, Paragraph, and Quiz.

    Even though the quiz block is present, it’s not shown on screen if there are no questions added. Therefore, the distraction should be minimal.

    Which blocks are you looking to remove from the default template?

    Thread Starter neo1664

    (@neo1664)

    In the same file, what I’ve /*’d out was lines 98, 99, and 107-111.

    This then removes the Lesson Properties, Contact Teacher button, and the quiz from a new lesson.

    This does me perfectly! Basically, once this is working, I’m somewhat handing it off for future lesson creation, and I know those elements will not be required, and I know full well questions will be asked every time if I leave things in that people don’t know what to do with. So if I’m able to remove them, which I have now been thank you, it will save my time in the future 🙂

    Thanks @dericleeyy for the responses, found what was needed and all working now thank you 🙂

    Hi @neo1664 ,

    > In the same file, what I’ve /*’d out was lines 98, 99, and 107-111.

    Which file do you mean? Is it this one:

    https://automattic.github.io/sensei/includes_blocks_class-sensei-lesson-blocks.php.html

    If so, just a friendly warning that edits will be overwritten on any updates to Sensei.

    While we do provide templates for some Sensei pages (which means they can be safely edited and changes preserved through updates), files which contain core functionality like this do not have templates.

    Hence, the filter provided: sensei_lesson_block_template, as Deric mentioned, but that does require you to write some custom code.

    Best,
    Cena

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

The topic ‘Customise New Lesson’ is closed to new replies.