Show custom fields without updating

Support MB Blocks Show custom fields without updating

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #38048
    info@j0e.org[email protected]
    Participant

    Hello,
    I have created a block where I use other custom fields, which get not updated in that block.
    This custom fields gets rendered on the homepage, but not in the editor.

    {% set review_summary = mb.rwmb_meta( 'review_button_text', '', post.ID ) %}
    {{ review_button_text }}

    How can I show the variable "review_button_text" also in the editor?

    thanks
    Jochen

    #38056
    Long NguyenLong Nguyen
    Moderator

    Hi Jochen,

    Please use the helper function mb_get_block_field() to display the field value in the Block editor.

    {% set review_summary = mb.mb_get_block_field( 'review_button_text' ) %}

    Read more on the documentation https://docs.metabox.io/extensions/mb-blocks/#render_callback

    #38058
    info@j0e.org[email protected]
    Participant

    My site is crashing, if I use the function mb_get_block_field().
    I am in the field "Render code":
    screen

    #38059
    info@j0e.org[email protected]
    Participant

    mb_get_block_field() was not working.
    But I had to replace post.ID with post_id

    #38067
    Long NguyenLong Nguyen
    Moderator

    Hi,

    In the Render Code area, you can use the field ID only to display the field value or use the helper function without passing two parameters.

    {% set review_summary = mb.mb_get_block_field( 'review_button_text' ) %}
    {{ review_summary }}

    or just {{ review_button_text }}

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