 Welcome back to the channel, today we're going to talk about our block pattern. Right now I have my WordPress 5.32 installed, I have Gutenberg installed as a plugin and it only works on the A2 5.3. So that's where we tap all the new experimental things and maybe in the near future you're watching this and this is part of the WordPress code. So when we go to create a new post we'll see that we have a small icon here that talks about block patterns and when you click on it it allows you to choose different items and as you click them you add them onto your board and you can use them. So if you want you can actually take out a couple of things, edit them and you'll notice that this block as I change it it doesn't affect this other block here they come from the same pattern. Now this is the biggest difference between the reusable block patterns that you can see how to use in the video that I've linked here and what these block patterns are. So this is the way WordPress is going to start doing things allowing us to experiment with different patterns, people design them and maybe you can import them if you've used the elemental plugin this is what we are talking about those small widgets allow you to import data that has already been designed and you just need to edit it. So let's jump into the code to see how we can design our own patterns. I've been looking at this and I found a very wonderful article from a lady called Melchoice and you can go to melchoice.design and you'll find an article that she's written and it's called creating a simple block pattern for your plugin where she writes all the steps of how to do this. So in our plugins here I have a small plugin that I've created which I'm going to activate now and essentially it's just just having a plugin name, a URI, the author and all the things that are needed to run a plugin. Why do I use a plugin? Because we're going to be handling data. I don't want to add this content through the functions that PHP of the theme and at the end of the day we find that as we change themes we're going to lose our data or pattern that we've already created so I would prefer to put it in a plugin. So let's jump into the code. So the first thing that I will do is I'm going to add an action and in this action I'm going to tap the word press in its hook and then I'll write a new function a new callback which I'll call a take a press patterns and then I'll just remove all these other stuff that I don't need. I'm not going to pass any arguments and then I'll close this off with a semicolon. So what I'm going to do is now write our function here take a press patterns close it off and then we'll add our parentheses and our brackets. So I'll add a little space down here to make the code look a little nice and we have this ready to jump in. So what do we need? In Gutenberg we have a function that is given to us and it's called a register pattern in singular and we'll terminate off with a semicolon but what I'm going to do is I'm going to first check if this particular function exists then we can run it so going to come here and then look for the function if function exists and then we'll of course run our register pattern in the closest off and save so if we have register pattern we'll run register pattern now register pattern requires only two arguments the first one is the namespace of our pattern and so I'm going to have this pattern and I'm going to call it a take a press and then I'll slash it off with the pattern name and then what I'm going to do next is that we are required to have an array and this array is going to carry two things only it will carry a title and it will carry content so we need to wrap these in a single quote and then I will map off with the equal sign and the greater than sign and then we'll add the content in the following pieces so we're going to have our title and we're going to of course translate it so we're going to have our title first here and then we'll translate it using this string so the first thing that we add here is our title name so we'll call this best line for now and then we'll add our text domain right here at the end so we'll have our content and then we're going to map onto it with this time with double quotes because we're going to add here an escaped string now let's go back to our admin area we don't have any issues without plugins so far so let's go to the post and add new a recipe kind of pattern first of all so I'll add columns which are going to be two pieces in our column here we shall have a heading a title and we shall call it a recipe name and then under that we'll have a picture and we'll load that for my library so lists I'm going to add don't start shake well serve to customer and then of course in this other block we'll add a paragraph and I'm just going to copy some text from this article just to make it enjoyable so we'll copy this so we'll copy that and then test this content here I'll make another paragraph and we'll have that ready so I'm going to just go to a navigator here click the column to see that everything is actually wrapped so we are going to go to our code editor and then we'll just copy all this code and then come to this online tool which is called onlinestringtools.com slash escape dash string and we're going to paste our code there and at the end we'll have an escaped string so we're going to copy this and then we're going to come and paste it inside our content area so we'll save this once this is saved we'll come back and reload our page still in the code editor so we'll come back to the visual editor here and I'm going to choose the patterns icon here and we'll see that as we scroll down we actually have a baseline pattern right here so when I click it we have a new pattern pattern I can add this over and over and over again and so we can write different things so what I'm going to do is just edit a couple of things here and you realize as I edit this part of the pattern these other patterns are not affected in any way now this is the difference that comes with our reusable blocks once you edit a reusable block all across your site where you've applied that reusable block it is going to change however with the patterns it doesn't change at all so we have our pattern and it's here and it's ready and we can use it right now and because it's going to be improved it's going to be made better this is the way what press is going to be doing things so we have our pattern it's usable and we have our code right here and we can do so many other patterns depending on our imagination so if you enjoyed this video please give it a thumbs up let me know what you think about patterns are you using them are you sticking to usable blocks just let me know what you think about them are you trying them out see what other patterns that are available let me know in the comment sections about what you think about all these things so in the next video I'll share with you how to do block patterns without actually writing any code whatsoever so stay tuned to the channel and goodbye