-
nicole
I have created content using Generateblocks. I want to take the block and turn it into shortcode that I can then insert into a page that uses the classic editor.
It doesn’t necessarily have to be shortcode. I can also just get the code that I can insert into the classic editor.How do I do this?
-
Alvind
Hi there,
There is no straightforward way to do this, but you may try David’s alternative solution here:
https://generatepress.com/forums/topic/block-element-as-a-shortcode/#post-2043954 -
nicole
Thanks for the reply but I don’t really understand how to do it. David’s solution seems to focus more on how to create the shortcode. I already have a plugin for the shortcode but I don’t know how to get the code from the block and put it in the plugin that will turn it into a shortcode.
-
Alvind
It is indeed complicated, but this is the only way to do this at the moment. Basically, this is how it works:
The shortcode generated by the code essentially acts as a hook. You can then add it anywhere you want to insert your reusable block.
The block that you want to insert into another page must be created as a Block Element. Then, in the ELEMENT TYPE setting, choose Custom Hook and add the hook name generated by the shortcode inside the CUSTOM HOOK NAME field.
-
nicole
Thank you.
-
Alvind
You’re welcome 🙂
- You must be logged in to reply to this topic.