black friday sale

Custom Fields
Re-Envisioned
Support MB Blocks Front-end / back-end render_template different

  • Creator
    Topic
  • #17603
    Resolved Key_Webdesign
    Participant

    Hi there,

    I have made a custom Block with MB Blocks which presents a loop of custom posts. In the output of this block are many link tags (<a>), which is pretty unwanted in the Gutenberg editor itself, because you can now click on items in the Gutenberg editor itself, redirecting the entire page to the permalink…
    I would like to remove these link tags in the back-end (admin) mode and replace them with, for example, <div> tags.

    Now I tried to use both the render_template and the render_callback function but this does not work.

    Is there a way to get this to work?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #17615
    Anh Tran
    Keymaster

    Hi, have you tried using the $is_preview parameter for the render_callback and render_template? It allows you to render the block differently on the back/front end.

    #17633
    Key_Webdesign
    Participant

    Hi!

    I have tried something, but that didn’t work.
    Do you have an example code for this function?

    #17644
    Anh Tran
    Keymaster
    #17650
    Key_Webdesign
    Participant

    Yes, that did the trick!
    Thanks a lot!

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