Hi there,
Sometimes I used to apply a custom class, say ‘editor-sopb’ to the body via body_class filter when SiteOrigin PageBuilder was in use within the page.
I usually checked for
get_post_meta(get_the_ID(), 'panels_data')
Unfortunately, I’ve found out that the Block Editor version of the builder does not save anything in that post meta.
I was wondering if there’s another way to check for it, aside from using siteorigin_panels_render, which may add some overhead for a bool check like that (am I wrong?).
Thanks for all the work you do guys!
Hi Frafor,
Thanks for getting in touch. The best way of identifying whether a page has a SIteOrigin Layout Block present is to parse the post content using parse_blocks. This will give you an array of all of the blocks used on the page. Iterate that data (there’s some great examples of this at the above link) and check if the blockName equals to siteorigin-panels/layout-block.
Kind regards,
Alex
Hi Alex, thanks for the suggestion!
I think I’ll iterate via parse_block on save_post and add a custom field to save the outcome
Hi, thanks for your reply. Hopefully, you’ve made progress.
Cheers
Andrew