Hello, I’m new to WordPress and I’m making my own plugins to add functionality to it. I’m wondering what would be the recommended way of doing the following:
I have a custom block MYPANEL. This custom block works just like a div with a default class and I can put whatever I want inside of it. The point of the custom block MYPANEL is that if later I want to change the HTML of MYPANEL I can do it from the PHP side.
For example, say today MYPANEL is a div with a CSS class that gives it a black border. But in 3 months I decide to redesign MYPANEL and my new design needs a wrapper div to work for some reason, or 3 divs, or I want to use
<figure>instead of div, etc. I want to be able to just change the PHP template instead of having to update every post.
I couldn’t find documentation on what the arguments passed to
Should I iterate the inner blocks and call render_block on every inner block to get their HTML and just concatenate that? Although this probably should work, if $content contains the rendered blocks already, I’m calling all the rendering callbacks of the inner blocks a second time. I think there was an argument called skip_inner_blocks that looked like it made WP skip rendering the $content, but I couldn’t find any documentation on it. Is that what it is for? Is there something like a skip_outer_block setting so I can take just the inner blocks’ content?
What’s the recommended way of doing this?
- You must be logged in to reply to this topic.