• Welcome to the all-new Kolakube support, the official place to get help for Marketers Delight, XFtoWP, CryptoWP, and other WordPress products! Please login with your account details to access private support forums.

Unable to register Blocks using Dropin System

gauravtiwari

Blogger
Md
Messages
266
Reaction score
114
Website
gauravtiwari.org
Hi @Alex, I am trying to develop an accordion block using native Accordion CSS styles. But I am unable to register Gutenberg Blocks using MD-Dropins. Can you confirm if registering blocks inside the child theme is possible or I'll have to create a separate plugin?
 

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,497
Reaction score
1,826
Yes, registering Gutenberg blocks from a child theme is possible as the MD registers blocks as a "parent theme". Does the same code work if you do it from a plugin? Feel free to also post the source code you have for the blocks registration.
 
Comment

amalseed

Well-known member
Md
Messages
238
Reaction score
47
Yer man, I have seen this (and I use it), but I was thinking something you could use within the main content section (not just sidebar).
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,497
Reaction score
1,826
Yer man, I have seen this (and I use it), but I was thinking something you could use within the main content section (not just sidebar).
I see, it is definitely possible and reusing the markup is a pretty straightforward copy/paste into an HTML block at the very least. Would make for an awesome block indeed.

If @gauravtiwari releases it as a theme mod I will promote it, otherwise it’s worth creating an official suggestion thread so we can keep better track of it.
 
Comment

gauravtiwari

Blogger
Md
Messages
266
Reaction score
114
Website
gauravtiwari.org
Hi @Alex , I give you the plugin I have created. I in the md-accordion.php you will see that I am forcing MD.accordion(); wherever the block is used. But that script only works with an ID and Gutenberg doesn't allow adding ID to Blocks. Can you help me finish this as you know accordion script inside out. I will take days to figure out the problem.

Meanwhile everything else works fine. If you choose to open an accordion - Gutenberg assigns .active class making it open. But without the accordion script it is not possible to toggle (Natively, at least).
 

Attachments

  • md-accordion-one.zip
    12.4 KB · Views: 2
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,497
Reaction score
1,826
Hi @Alex , I give you the plugin I have created. I in the md-accordion.php you will see that I am forcing MD.accordion(); wherever the block is used. But that script only works with an ID and Gutenberg doesn't allow adding ID to Blocks. Can you help me finish this as you know accordion script inside out. I will take days to figure out the problem.

Meanwhile everything else works fine. If you choose to open an accordion - Gutenberg assigns .active class making it open. But without the accordion script it is not possible to toggle (Natively, at least).
Thanks, I remember writing the script and cursing at myself for taking the "easy" way out by using ID selectors. I will take a look into this as soon as I can and see if it can be modded.
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,497
Reaction score
1,826
Hi @Alex , I give you the plugin I have created. I in the md-accordion.php you will see that I am forcing MD.accordion(); wherever the block is used. But that script only works with an ID and Gutenberg doesn't allow adding ID to Blocks. Can you help me finish this as you know accordion script inside out. I will take days to figure out the problem.

Meanwhile everything else works fine. If you choose to open an accordion - Gutenberg assigns .active class making it open. But without the accordion script it is not possible to toggle (Natively, at least).
How did you fare with this? There will be some much needed Block editor style updates in MD5.3.2 and I found this article. Making the the accordion script more flexible is a high priority for a maintenance release.

In the very least I'd like to make the accordion script that doesn't rely on IDs, or keep the toggles when multiple accordions are on the same page.
 
Comment
Top