• Resolved paulluxford

    (@paulluxford)


    Hi there

    I want to be able to use ACF and create a field to pass data dynamically to the Code Block.

    Is this possible to do and if so how would I go about that.

    Thanks very much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Kevin Batdorf

    (@kbat82)

    So you mean have it render on the server, or something else? If so, it’s not possible because the block renders in the browser (as you type), and not on the server.

    Thread Starter paulluxford

    (@paulluxford)

    Hi Kevin

    Thank you, some more context to what I am trying to achieve.

    I have a block template website where I provide block editor code so a user can just copy the code and paste it directly into the WP block editor.

    You can see the example template here > https://gstemplates.com/design/feature-beta/

    So under the Get the Code accordion, you’ll see I have added code in the Code Block for that specific template design.

    I am doing this all manually and I want to be able to use an ACF field (text or WYSIWG in text mode or other) to then have that code display dynamically in the code block. So that way I can create a custom post type template and just use fields to populate the data instead of adding the Get the Code accordion block in manually each time.

    Hope that makes sense.

    Plugin Author Kevin Batdorf

    (@kbat82)

    Yeah it’s just not possible, unfortunately. The code is processed through in webassembly so it’s not likely it will ever be possible either unless I added an entire runtime to the plugin. The only way you could automate it is with some sort of CI script that opens the page in a browser, edits it, processes it, the persists it somewhere. You could do that with something like playwright or cypress.

    Thread Starter paulluxford

    (@paulluxford)

    Totally understandable and thanks for clarifying Kevin. Much appreciated for your speedy replies ??

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