[Resolved] Universal Shortcode to Display Block Element

Home Forums Support [Resolved] Universal Shortcode to Display Block Element

Home Forums Support Universal Shortcode to Display Block Element

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2337942
    Matthew

    It would be really useful to have a shortcode where we can display a block element anywhere we like, without connecting it to a hook. All major theme builders do this already (e.g. Elementor Pro). And what is GeneratePress Elements if not a theme builder.

    Yes, I’m aware of this shortcode solution:
    https://generatepress.com/forums/topic/block-element-inside-another-block-element-content/#post-1904275

    However, it requires a separate shortcode for each block element, and it would cumbersome to manage more than a handful.

    Instead, why not create a universal shortcode where we can insert a block element by its id?

    e.g. [block_element id="42"]

    #2337995
    David
    Staff
    Customer Support

    Hi there,

    Thanks for the suggestion, its great to hear this kind of feedback.

    First thoughts would be – we add a GP Block to do it, instead of a shortcode.

    Question; how would this differ or add benefit over say using a Reusable Block?

    #2339877
    Matthew

    You make a fair point about reusable blocks David. The percentage of situations where a shortcode is useful and reusable blocks is pretty small.

    In this case, I’m looking for an easy workaround to design a mega menu using Generateblocks, which I can then inject into the traditional menu UI using a shortcode.

    I also use the classic widgets plugin (the block-based widget UI annoys me).

    Another use case would be to inject block elements into a plugin that isn’t fully Gutenberg compatible.

    I guess my feeling is: if it’s easy enough to do, why not add it. A percentage of your customers will find it valuable.

    P.S. The pace of support requests is pretty incredible these days. Credit to you and the team on being able to address most/all of them. The growth of GeneratePress has been incredible.

    #2340369
    David
    Staff
    Customer Support

    NOTE regarding block widgets, you can disable them without a plugin:

    https://docs.generatepress.com/article/disable-the-block-editor-in-widgets/

    Our biggest issue with shortcodes / blocks that are built into the Theme is that it can lead to theme lock, as switching theme means the “loss” of that content and redundant code is left in the post content, that may require manual removal. This kind of theme / plugin lock is something we try our best to avoid.

    The Navigation Menus, thats a real tricky one.
    If shortcodes in menus work for you, then the best we can offer at the moment is the shortcode method that Elvin provided here:

    https://generatepress.com/forums/topic/inserting-custom-php-html-into-gutenberg-or-site-container/#post-1713422

    P.S thanks for the kind words, although we have been a bit slow this last week as we decided to let people to take holidays lol 🙂

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