Skip to main content

How to add a custom Gutenberg block in the lesson editor?

Hello,

I've developed a custom Gutenberg block (an interactive flashcard) that works perfectly in the standard WordPress page and post editor.

However, this block doesn't appear in the FluentCommunity lesson editor. I've tried several approaches:

  • Using the allowed_block_types_all filter to force-add the block
  • Loading assets via enqueue_block_editor_assets
  • Using the fluent_community/portal_head and fluent_community/portal_footer hooks

None of these solutions worked.

Is there a specific FluentCommunity hook or filter to allow custom Gutenberg blocks in the lesson editor? Or is there a block whitelist that I could modify?

Thank you in advance for your help!

Bonjour,

J'ai développé un bloc Gutenberg personnalisé (une flashcard interactive) qui fonctionne parfaitement dans l'éditeur de pages et d'articles WordPress classique.

Cependant, ce bloc n'apparaît pas dans l'éditeur de leçons de FluentCommunity. J'ai essayé plusieurs approches :

  • Utiliser le filtre allowed_block_types_all pour forcer l'ajout du bloc
  • Charger les assets via enqueue_block_editor_assets
  • Utiliser les hooks fluent_community/portal_head et fluent_community/portal_footer

Aucune de ces solutions n'a fonctionné.

Existe-t-il un hook ou un filtre spécifique à FluentCommunity pour autoriser des blocs Gutenberg personnalisés dans l'éditeur de leçons ? Ou y a-t-il une whitelist de blocs que je pourrais modifier ?

Merci d'avance pour votre aide !

Kaneisha G.

Ross FCA has figured this out. He might be able to weigh in.

arjun arjun

Raph P The topic of enabling the addition of a few additional gutenberg blocks like the "Tab" block and the "Accordion" block has been discussed in this community a number of times by different community members. As Course Creators adopting the newly emerging trend of Text-Based/Text-Laden Courses, we urge the Fluent Community team/Shahjahan Jewel to at least add these blocks into the list of current available blocks inside the lesson editor.

And, for developers who want to incorporate their custom blocks, the FC team can think of providing some hooks or relevant structure to add them in such a way that the speed and performance of the FC plugin would not be affected as it would only be a case of individual site-specific customisation.

This way, the plugin would have its speed/performance feature not that affected either, and would also happily enable developers to add the custom blocks of their preferences.

Helmar Rudolph

I collaborated with ChatGPT in order to create a shortcode that renders beautifully in the Lesson editor. It accesses (for now) several custom SQL tables and populates my CSS-driven tabs.

arjun arjun

Helmar Rudolph wonderful. I can see in the screenshot that you have created "Tabs" with your shortcode. This is very impressive. I had been trying to create "Tabs" like you have done ... but always found it overwhelming. Is it ok for you to share the short code snippet here. That would hugely benefit us. Thank you Helmar.

arjun arjun

Helmar Rudolph Hey Helmar, thank you so much for your kind act of sharing the snippet....and thank you for that personal message at the top reading "arjun I sanitized it as much as ....". The code works so beautifully. I might ask you (might only...!!!) in case I need some relevant guidance from you... But for now, it's really complete and much helpful. Very much appreciate this act of yours, Helmar!

Helmar Rudolph I don't see a place to add a shortcode, where did you add it? I don't use Gutenberg so maybe that's where I'm getting lost?

Helmar Rudolph

Wendy Perkins Shoef chatGPT told me to try and enter it anyway, even though there's no support for it, it may just work - and it does.

Helmar Rudolph

Helmar Rudolph

arjun arjun you're most welcome. Glad to hear it works well for you.

+1