Decoding the template attribute for Inner Blocks in WordPress

InnerBlocks is quite a nifty feature in WordPress. It allows you to set up a new block comprised of existing blocks in a pre-defined layout in the content of a post. They prove to be very useful when dealing with sites having monotonous content on a number of posts. It can be a real time saver. In order to set up a block containing InnerBlocks, refer to the official documentation. It will clear a lot of things for you. However, in this article, we will not be talking about setting up InnerBlocks. In this post, we'll focus on one particular attribute template. The layout of a block is set up with the help of this attribute and frankly, it's not very well explained in the official docs. So, I thought of shedding some light on it.

How to use wp_add_inline_style the right way

Whenever developing a WordPress Theme or plugin, you might have surely felt the need to modify some CSS properties such as colors, font size, transitions, hovers and other CSS elements using PHP. There are many ways to do so but we are going to focus on the most recommended one i.e. wp_add_inline_style. This function is used to add custom CSS styles to already enqueued files. Let's see how it works.