 Welcome back to the channel. In today's video I'm going to convert this section of our footer into a block kind of template so that when we want to change stuff we can easily edit them in the block editor and then we can use them in our classic theme. Now the reason I'm doing this is because number one I'm changing this into a block theme and it will no longer be the classic theme. Number two this was built in a very funny way in that it makes editing this really really hard in order to change these details you have this theme options page where you go and just click and create and change things all through and then once you do that and hit save then they'll update here. But you have to go into the navigation area to get this correct and that's kind of time consuming and not so intuitive. So we're going to use what we call block template paths. Now how do we do this? Let's jump into the code. I'm going to open up my editor now and inside this space we are doing block stuff here. What we're going to do here in this if condition is we're going to look for the block underscore template paths as a function. Now because we're going to use this I'm going to copy it and paste it here. I'm going to first say let's find out whether this function actually exists and this has to be a string whenever you're looking for function and you get the name of this function and place it in here. So all of this is nicely clean here. So if this block template function actually works I want to look for a template path called footer new blocks. What press will be looking for an HTML or PHP file that's called this and this should be found inside our theme in a folder called paths. So inside paths we need to add this file and then we can say HTML. So because this is HTML I'm going to add a paragraph tag. I'll add take you press in here so that we can preview. I'm going to save this. The next thing that we need to do is inside our functions that PHP file we need to use the after set up theme hook. Now I'm already using this in here and I'm using it to add theme support for post thumbnails title tags and so on. Now what I want to do is because I'm writing stuff for blocks here I'm going to use this same hook here and I'll say add action and the tag or hook that I'm looking for is this and I'm going to add a new function and say this is for block related theme support and that will be the name of my function. Of course I can just add safaris to prefix it and make it look a little bit unique. Of course don't forget the semicolon and I'm going to define the function here and inside here we're going to actually add our code that we want to do. We want to do the add theme support. We want to support block template parts so I'm going to add it here but in this particular case this uses dashes instead of underscores and this is going to be with an s so block template parts. We are now ready to use this new template part inside our footer.php so what I'll do is come to our footer.php. I'm going to erase everything inside here and start off afresh start with our php and say this is footer template and after adding our comments to tell us what's happening we are now going to move this function that we're checking for and we're going to place it here and this function is going to look for this template part which is called footer new blocks and we already have it in our parts area here and it's called footer new blocks. So I'm going to go back to my browser I'm going to reload this and you will see that this is actually now giving us sticky press right here so if we want to have a new footer I'm just going to click pages right now because we're not using this with a block theme the best way to handle our editing is to use something like this page that has the block editor. Let's use the column block because this is going to work very well we'll go for 50 50 the first thing I want to do with this column block is give it a background and the background is going to be black the text will be white so that we can see what's going on and inside here I'm going to add a paragraph and say this is the part where we want to add copyright 2023 and say the name of our site is blog safaris theme and then in this particular section I'm going to add a social icon block and I'm going to say let this be justified to the left they should be opening in the new tab and then we can give them an icon color of this orange or this yellow for now so I'm going to click this plus button and say let's have Facebook and our Facebook should link to HTTPS and we'll have that right there click enter and after doing this we need to add a plus sign and we're going to add our Twitter and we'll say Twitter also should just be the same click enter now we're going to change this from the default and say let's have logos only or you can choose to have bills I prefer the logos and now I need to extract the html of this whole thing that I do have so I'll come to these three dots right here I'll click code editor and then I'll copy all the content that's in here then go to my editor and I'm going to go into our footer new blocks and I'm going to paste all this content here and hit save so once I do this I am able to go back to my browser go and reload this page we'll see we have our edited content right here now the differences you're seeing in the editing is because I am not supporting the different pieces of styling that are available readily like supporting a line wide or a line full width and so on so we have this kind of conflict in the CSS but once I do that my adding the theme dot jason file in here and then I begin adding the different pieces that are required so let me go to this section I'm going to look for the theme dot jason and I'm looking for the wordpress schema and we can actually get all these particular settings in if we need to have them so I'm just going to copy layout in here I'll come back to our editor I'll add it in here and you see this is going to do something different so I'm going to just save this draft so that we don't lose what we've edited I'll reload this and you see that now when we click on our column we actually have this new piece of information that says hey you can align this wide or you can align it full width so you can see that in the editor you have all of this and all you need to do is actually come to the code editor select all of this copy it come to your code editor and then replace whatever you have inside this template part I'll hit save so that when I come to the front end we reload this and then once I inspect this element you'll see that we have aligned full as a new class showing up and we have quite a number of things that are conflicting because this theme had already a number of styles going on I'll be creating a series where I show you how to create a block theme from scratch in this particular case I can actually exit this I'm going to add new columns and I'm going to go for the triple three I'll have this column block just maximum wide inside this I'm going to add an image and I'll use my media library I'll look for a logo click on this and you'll see that it's actually having the image I'm going to use this panel just to change the background select this change until let's have this as the orange background we can actually reduce this so that it's not so huge in here I can add a navigation if I want to like this and then inside here I can go ahead and add pages by clicking the pages list and you'll see this working so all I need to do is just come back to the code editor select all of this go to my editor as well and then I'm going to replace the html that we have here save this come back to the front end test that it is working and you'll see that it actually works I'm not doing so much of coding I've changed the template parts and this is working so you can have as many template parts as you want as you migrate your site from a classic theme into a block theme now we're going to work how to do this from scratch so that we're not having so many conflicts with our css and we're able to do this as perfectly as possible if you enjoy this video please give it a thumbs up don't forget to share it with your friends and subscribe to the channel if you're new there's so much about Gutenberg coming in and I hope this helps you in your daily workings with wordpress otherwise enjoy whatever you're developing