Custom Fields
Re-Envisioned
Support Meta Box Builder How to render block preview from Meta Box Builder

  • Creator
    Topic
  • #31054
    Matt V
    Participant

    I'm building some blocks using Meta Box Builder, and I like the process so far.

    Unfortunately, none of my blocks have previews, and I can't quite figure out how to add them within Builder itself.

    I see how to do it in MB Blocks in the docs and in other forum answers. But I don't see a corresponding set of fields in Meta Box Builder. Is there a way to render previews from Builder?

    Thanks for your help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #31063
    Long Nguyen
    Moderator

    Hi Matt,

    Meta Box Builder does not support full coding settings. We will try to do it in future updates. For now, please use the code to show the block preview.

    #31065
    Matt V
    Participant

    Hi Long. Thanks for your help.

    When you say that I should use the code to show the block preview, what is the syntax for that? Is that where I’d use is_preview?

    #31068
    matija
    Participant

    Where do I put the code in Meta Box Builder to show preview?

    #31071
    Long Nguyen
    Moderator

    Hi,

    The variable is_preview lets you know if you’re in the preview mode for Gutenberg or on the front end. It’s useful when you want to display a custom message to users when they edit the block on the back end. See my screenshot https://imgur.com/s295oqk https://imgur.com/r9025Zv

    Get more details here https://docs.metabox.io/extensions/mb-blocks/#render_callback

    If you use the block setting preview, the content will show on the small preview area. Screenshot https://imgur.com/mMB5a5m

    Get more details here https://docs.metabox.io/extensions/mb-blocks/#preview

    #31073
    Matt V
    Participant

    Thanks, Long. I see how is_preview works now.

    What I hear you saying is that Meta Box Builder does not yet have a way to set the block setting preview, so it is not possible to generate the small preview with Builder. And if that is important enough, we should code the block in MB Blocks instead.

    Did I get that right?

    #31083
    Long Nguyen
    Moderator

    Hi,

    Yes. To use all settings of Meta Box and extensions, I recommend using the code. You can also manage and customize custom blocks the way you want.

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