Porchy Web Development

Filter the content to put an Gutenberg editor block’s attributes on the front end (part 3 of 4)

On the front end, I need access to the block’s attributes so I can use those in building the front end block. Instead of rendering the block as normal (either as a dynamic block or saved html), I’ll put in a filter to render something which looks like this:

The filter I’ll use is render_block. I don’t want to register the block as a server side render because that will affect the editor, so I’ll just hijack it here. Plus it’s a bit more straightforward to me.

I’ve added that to the plugin.php and that’s all I need to do to get the block html on the front end as I’d like it!

You can see what I’ve added here and the state of the repo at this point in time here.

Posts on this

Join the newsletter

Subscribe to get the latest content by email.

Powered by ConvertKit. If you give me your email address, you may receive emails from me (JJ) about posts on this site. You can unsubscribe at any time.

Porchy Ltd is a company registered in England, no. 12035925

VAT Registration no. 331196421

Built with WPGraphQL and Gatsby

© 2019 - 2021