Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

How to turn a block into shortcode

  • 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?

  • Hi there,

    There is no straightforward way to do this, but you may try David’s alternative solution here:

  • 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.

  • 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.

  • Thank you.

  • You’re welcome 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.