 And we are live and we are recording. Welcome everybody. It's nice to see you all again. Welcome to anybody who's new to these Thursday Let's Code sessions. Welcome to those of you who have joined us before. Well, we're all getting set up. If you haven't already and you would like to start getting your plugins and things installed, you can install the latest version with the Gutenberg plugin. There's a theme that we're going to be working with. We'll go through all of that in a second, but you're welcome to start downloading and installing those things now. And then there is the fake up press plugin that we'll be using. We should also welcome to install. Gonna paste this into the chat if anybody needs links and things. Feel free to go ahead with all of that. I have decided to stop the background music because it's just too much of a pain to manage. So it's just me and whatever background noise is around me. Do we need 6.1 for the session? If you install hygiene, if you install the Gutenberg plugin, you're effectively getting the same content or the same functionality as 6.1, which is why I recommend folks just install a stock standard version of WordPress, whatever the latest version is and then install Gutenberg and then you'll get all the 6.1 things. The version of Gutenberg that is shipping with 6.1 is I think 14.1 or something and the current version of Gutenberg is 14.3. But if you just install standard WordPress and then Gutenberg, you should be good to go. So hi, Jeremy. Hi everybody, you're welcome to say hi in the chat. Let us know where you're from if you want to and then we can start getting things going. Oh, I didn't change this. I didn't change this. Let's change this now. As you can see, I... In good open source methodology, I clone my current slides from my last session to make the new ones and make their change on that slide. So that's funny. So today we'll be creating custom templates and template parts. If you've been following along on these Thursday sessions, we've been kind of working through the process of building themes, building block themes. Previously, we've looked at things like theme JSON, we've looked at enabling settings, enabling styles. We started looking at how to create templates in the editor. We looked at how to export things. Adrian, yes, the theme has been updated. So if you want to grab the latest one, please do grab it from that link. It's not too much of an issue. If you've got the current one, it doesn't really matter but there have been some minor changes which I've updated in that link. So please grab the latest version, which we will go through in a second. And so today we're going to be focusing on custom templates. So we'll talk a little bit about what I mean when I say custom templates. Not so much custom templates, just more involved templates, not specifically the primary templates. Okay, so as always, a couple of announcements. Again, welcome everybody. Welcome if this is your first time. Welcome if this is your 100th time. I don't have a course with me today. Nobody was available. And I kind of posted things a bit too late anyway. So it's kind of my fault. So please bear with me if I don't have the usual assistance that I usually do. As always, we're presenting in focus mode. You are welcome to ask questions as we go along. You're welcome to have us questions in the chat or unmute. We're finding what works well is if folks ask questions in the chat and if I then need more information, then I'll just ask you to unmute and ask a question verbally. As I was saying earlier, to get your local installed ready to work with me today if that's what you want to do, download the latest version of the workshop theme. Every future workshop that I do will be updating that theme, whatever the current update we do today, for example, would be part of the next one. So if you haven't updated it today, I should probably look at some way of maybe setting up auto updates for that. That would be cool. So you just hit updates in your dashboard. I'll see if I can get to that in a week. Make sure if you're running WordPress 6, the latest version of WordPress, make sure you've got the Gutenberg plugin installed so that you get some of the features that are coming to WordPress 6.1, which is what we're going to be working through. I'm going to just copy and paste these links again in the chat for anybody who's joined us and then install a plugin called FakerPress, which I will go through as part of this workshop anyway. So if you haven't got around there yet, we'll work through it together. And FakerPress is just a plugin that allows you to generate fake data or dummy data, which we're going to need today. So I found that plugin very handy in the past to just generate fake posts and pages and whatever else. As always, I am caffeinated. So if I'm going too fast, please do let me know. And we will be posting the session to WordPress TV afterwards. As always, I usually post them on Friday. And then if you're looking for more WordPress-focused content, you can go to learn.wordpress.org. I'm just especially busy pouring my coffee off to the side here. I apologize while I pause to do that. And then we can stick it over on the right here and we can go. Okay. Today, we're going to be learning about custom templates and template parts. We're going to be looking at what I mean when I say custom templates and template parts, specific to developing templates in the site editor using the sort of the full site editing functionality of WordPress. We're going to look at how to create them inside the site editor. We're going to look at how to create them manually and why you might need to do it manually. And then we're going to look at creating a custom template part in the site editor and manually if there's time. And then how to register them in your theme.json file and why you would do that as well. So we're going to be taking it really slow today because there's a lot to kind of unpack. It's another reason why I've set this for an hour and a half because there's quite a lot to deal with. So please do stop me if anything doesn't make sense if you have any questions. Our objectives today are split over three slides. So that's how much I want to get through today. It seems like a lot, but that's because it's a lot of theory more than actual work. The actual work part is kind of the easy part today, believe it or not. So first we're going to generate some posts using FatalPress. This is unrelated to block themes so we have some content to work with. Then we're going to very quickly review the WordPress template hierarchy. I just had a funny thought. I wonder how that sound is going to come up on the transcriptions. And we're going to just get an overview of what I'm talking about between primary templates and sort of more custom templates. Then we're going to create two additional users on our site because we're going to need those users later on. And then we're going to start creating some templates. We're going to create a featured author template, which is a template that you might apply to a post if it's a featured post and how you can apply that through the post interface. We're then going to export that template to a file and register it in Team JSON. I'm going to show you how to do that. Then we're going to create a specific template for the single author archive template. And I'll explain in the template hierarchy when we go over that, what I'm talking about there, if you've never seen it before. We're going to edit that in the editor and then do the same process viewing it and exporting it and registering it. And then finally, if there's time and there should be time, we're going to look at custom template parts. Previously we covered headers and footers. Today we're going to look at what if you need just general template parts and how you register them and how you use them. Cool, so Mirko asked about data security and Laura said locals on a computer. So Mirko, I'm assuming you're talking about your local data when you're developing locally. So you shouldn't have to worry about security there as Laura has pointed out. If you're specifically asking about sort of security and WordPress in general, I can probably point you to some documentation and some tutorials, but unfortunately we're not going to be able to dive into something like that today. But yeah, let me know what you mean specifically by data security. Do you just mean on your local environment or do you mean security in general? While I continue, feel free to clarify that in the chat. Okay, right, let's do some coding slash developing slash building slash whatever you want to call it. I changed the image on the slides today just for the fun of it. But let's get into this. So my local WordPress install is here. I've got this URL called learnpress that I just got set up locally. And it's just a clean WordPress 6.0 install at the moment. You can see 6.02 down at the bottom. You have the right. It has, as far as I can remember, no plugins installed yet. Oh, no, I've installed Gutenberg. I have installed Gutenberg already and that is active. But otherwise I have no plugins installed and I have no posts except for the default posts that come with the WordPress and the same goes for pages. Okay, when you publish and use template. I'm not 100% sure what you mean there, Mocha. Let's go through the workshop and then if you still have that question, it's always there and then maybe we can deal with it because maybe going through the workshop will help you with that question. Block templates are HTML files that don't really have PHP issues so they shouldn't have any security issues. But let's go through the workshop and then right at the end if you don't feel like that question's been answered, you can bring it up again. Okay, and then I just have the default WordPress themes installed. So it's 2021, 2022 and 2020, which currently have default themes. Okay, so going back to my slides, the first thing we're going to do is just quickly generate some posts using FakerPress. So let's install FakerPress first. So if you have an install that already knows the perfect time to do it, you can just go add new and then search for FakerPress and it should come up pretty quickly. There it is. You can install it and activate it on your local site. Martin, on the latest version of WordPress do I need to install Gutenberg? I kind of use the beta full site editor. So with what we're doing today, you are going to need to install Gutenberg because some of the functionality we're using is not in WordPress 6, it's in WordPress 6.1. We'll talk about that beta site editor in a second. We'll talk about what that means, but you will need to install Gutenberg today to be able to follow along. Or if you're watching this later and you're following on later. So FakerPress, as I say, is this way of generating dummy content for your sites. I don't recommend ever leaving this installed on a production environment. I only use this locally. And if you click on in the FakerPress menu item, if you click on posts, it gives you an option to generate however many posts you need. Generally, what I do is I change the quantity here to 10. I change the date range to this year. But then I set the end date to the beginning of the end of the previous month. Because I don't want any, if you use FakerPress and you set it to any date range beyond today, then it'll create those posts in draft mode, which is not what I want. I want them today. Post type is post, so that's perfect. I don't need to worry about parents, comments I can leave as default. Author, I could change now if I wanted to, but I don't have any other authors. So I'm going to leave that as default. Now, it will pick up admin and add admin. The rest of the post content settings and the text on them is and all that, I'm going to leave as default. The only thing that I'm going to change is I'm going to remove, I think it's place hold it from the image providers. And I think that's because place hold it, there's a problem at the moment. It doesn't work so well with FakerPress. I haven't figured out the bag yet. I need to actually report it to the plugin developer. So I just removed that option. So just review FakerPress, click on posts in that menu, set to a quantity of 10, set this year, but then change the end date to, in my case, 30th of September, leave everything else as is and then just remove the placeholder.it image provider. And then we can hit enter or generate, sorry, at the bottom here. And you'll see it'll start showing me a little spinning wheel. And while it's generating posts, it'll do its thing in the background. While we're doing that, let's talk about the WordPress template hierarchy, which is the next item in our list, because it's always good to do something else while things are happening in the background. So the template hierarchy, if you haven't seen it before, it's the system that WordPress uses to determine what templates to use when rendering certain content. So as an example, let's go down, there's this nice little visual overview, which will open up here. And hopefully everybody can see it. I'm gonna paste this in the chat, so that if you want to follow along locally, it's always easier to see links and things on your local site. But I'm gonna open up this image and here it is. And so the template hierarchy is basically, for example, let's start with the author archive page. So the doc is the page types. So when it needs to render the archive for an author, in other words, all posts by author, it first looks for a template with the name author hyphen and nice name is not what it's looking for. It's looking for the author's nice name or the nickname, which in the admin's case would be admin. If it was me, it would be something like John or whatever. Author hyphen, nice name. And in the old classic themes, they would be PHP files and block themes they would be HTML files, but the name is still the same. If it doesn't find that, then it's going to find look for the author hyphen and the author ID. And this is the ID in the database template file. If it doesn't find that, it's then going to look for the author.php or .html template file. Then it's, if it doesn't find that, it looks for archive.php or HTML. And if it doesn't find that, it looks for index of PHP or HTML. Now, if you remember from some of our earlier sessions, I said to you, number of weeks back, number of months back even, that you can create a template with just your index template. Some of you might remember that. And it'll still work because the index template is the default base template in the hierarchy that all other types of content can use to render. Might not always work well, but at least the template hierarchy system will find at least that last cycle, fallback template, and it'll say, fine, use that template to render. So it always works in this way, sort of left to right as you look at this image. It looks for these ones in orange first, then goes down to the green and then to the purple and then very, very into the index. So what that means is you can, for example, create an author template for rendering all author archives. And then if you have a specific author that you want to display differently for their archive, you can create the author hyphen ID number or the author hyphen name template and it'll use those templates. And we're gonna do that a little bit later on. Two weeks ago, I think it was, we spoke about the primary templates and that was these list of purple templates here. So index, single page, archive, home, 404 and search. Those are the ones that if you're going to develop a WordPress theme, you should at minimum have those one, two, three, four, five, six, seven templates. You'll notice that there's a single and a page and then the fallback to single and page is singular. Singular comes from the pre-page days of WordPress. So before WordPress enabled to render pages where you just had posts. So you had an archive and you had a singular post and that was it. And then pages came in. So they had to create a single PHP for posts and a page.php for pages, but they both fall back to singular and obviously they fall back to index. Home is for your homepage. And that is when you set one of your pages to the homepage that you can have a one page template for all pages. And then you can have a separate homepage template for just your homepage. And then you have your 404 page and your search page. Cool. So when I'm talking about custom templates, what I'm meaning is anything that isn't one of these seven primary templates. And you'll see when we go into the site editor in a second that you can create the primary templates and a couple of those green ones that are actually secondary. If you look at the bottom left here, there's primary templates and secondary templates. So you can create all of the primary templates. And I think most of, if not all of the secondary templates as well, but you can't create any of the, what they call variable templates or I call them custom templates because those are variable. They depend on either the person's name or the ID, whatever the case may be. And today we're gonna focus more on those orange templates. So specific scenarios where I want to do specific things. There are two types of custom templates that I think about. I think about number one, those that belong to the template hierarchy. So they have a specific name of the file and that name means render certain content or just a template that you want for a specific use case, a singular use case that doesn't exist in the hierarchy. And so that might be a template that you want to apply to a page or a post on a per page or post limit, which we're going to cover today as well. Okay, so that's what I'm talking about when I talk about custom templates, something for a specific custom solution. You'll see this actually in the template hierarchy, there is a custom template option and you create a custom PHP and then that can be pretty much in it. That's kind of where we're going to do. Okay. So any questions on all of that, template hierarchy and templates and primaries and secondaries and all of that before we move on, I'm gonna ask per usual sip of coffee and then we can go from there. Okay, so while folks are thinking if they have questions, let's pop on over back to my generate post page right at the bottom, fake it tells me it's fake, it's a whole bunch of posts. It's fake post number ID 6, 8, 11, 13, 15, 16, 18, 20, 22, 23, which is great. Martin says this is exactly what I've been stuck with this week. Well, I hope we helped you this week, Martin. So those posts now exist. So if I switch over to my list of posts, now I can see a whole bunch of posts there. They're all assigned to the admin user. They're all currently uncategorized. I'm not worrying about categories today. We're going to focus on posts and authors, but they're my posts. It uses a system called Lorem Ipsum, which is this like printing dummy text system. And if we click on a post, for example, it's got some content. Some posts do have featured images, some don't. Let's actually find one that has a featured image so we can see it. Does this one have a featured image? This one has an image, but not a featured image. Okay, we'll worry about that later. So they're my posts. Then the next thing I want to do today is I want to create two additional users, okay? And I want to make them authors on the site. So I'm going to go over to my users list. I don't have a fake oppressor users. I'm just going to create the manually today. So I'm going to create one user called Jondo because I am super boring with coming up with names. And it's just going to be John at learnprest.test. And I'll just say John and Doe and it doesn't matter about websites. And we'll just give him a super simple password because it's all local. But specifically I want to make John an author because I want to use the author templates in a second. So if you're following along, it's John Doe or whatever name you choose, whatever email you prefer, first name, last name, simple password, confirm use of weak password. You don't have to do that. If you're never going to log into that user, it doesn't matter. But more importantly, make them an author so that you can see how all the author things work. Okay, so we're going to add that user and then I'm just going to add another user and I'm going to make Jondo again because I have no originality at learnprest.test. And I'm going to go to Jondo and I'm going to do the password as it is on that mind. But again, I'm making Jane an author. So I have two authors on my site. Okay, so I've got John and Jane and I've got myself as the admin, which is great. Then I'm going to go over to my posts and I'm going to assign half the post to John and half the post to Jack because I want to see the post by John and the post by Jack. So all I'm going to do to do that is I'm going to just randomly tick the alternating posts over here and I'm going to use the bulk action edit bulk action. And I'm going to say in the bulk edit bulk edit action I'm going to switch the author over to Jane and I'm going to hit updates. It's all I'm going to do there. And then for the post that I'm not currently set for Jane I'm going to set to John so I'm going to select all the other alternating ones and again bulk actions edit. I'm going to apply that. I'm going to set that to John. So now I should have five posts, five or six posts to Jane because we had Hello World to begin with and five posts to John. So now I have some author posts to deal with. So while some of you are still busy doing that while you're doing that I want to show you what that would look like on the front end. So if I go over here to the front end of the site and I were to type in author and you'll see I was doing it earlier today and it would be John Doe, for example and that breaks probably because I've used the wrong name. So let's just check here. John Doe, that should work. Oh, I know, hang on. I know what's going on. I don't have my permalink set because this is a clean WordPress install. So if you haven't done this go to your settings, go over to your permalinks and just make it the post name setting for now so that I can actually use the author permalink. So we'll save that and then pop back over here and author John Doe should work now and there we go. Now I'm seeing a list of all my posts by this author. We can verify this. The first one is that weird looking Latin name and the second one is that one. So if we go back to posts we'll see that John, that is the first one. We agree with that. And that is the second one. So we're happy. So it's only listing all posts by John. We can do the same for Jane. So let's actually grab Jane's URL for a second here. So Jane Doe. And now we should see a different list of posts. Hello world, perfect. So we're seeing what we need to see. Okay. So if there's anybody still sitting that up or busy processing all of that or putting all that together I'm gonna hold for a second and see if there are any questions. Jean says, sorry, how do we change the authors? Okay, let me go back to that process, Jean. So once you've created your authors you can go to your list of posts and then just use the little tick box on the left-hand side of each post and select randomly four or five posts. So there we'll select it. Then at the top of the post list there's this bulk actions dropdown. You click on that and hit edit. And then once that's changed then hit the apply button and that should bring up this little bulk edit screen at the top of the list. And then there are all the posts selected we can change categories if we want we don't have any other categories and then over to the right-hand tags there's an author dropdown and we can then select the author from that list and then once you've selected the author you hit updates and it'll do the update for you. So let me know if you're still getting stuck with that, Jean or let me know once you're ready to move on. Awesome. I love it when folks get things in the workshops even though this has got nothing to do with what we're actually doing today. This is just all the setup. Okay. So the first thing we were going to do today is we're going to create a custom featured author template for featured posts. Now, what do I mean by that? Also, Edger and Glam is helpful. I want to create a template that I'm going to apply only on a single post. And let's say I'm running a newsletter blog or a newsletter site and once a month I have a featured post by one of my authors and it must look a specific way. So it doesn't belong to the template hierarchy because I don't want it to always be on. I only want it on a per post situation. So in WordPress, and this has been functionality that has been around for a while, I'm going to use John's first post. Actually, let's use Jane's first official post. Quas, Suski put whatever that is. It's about grapes, so we'll go with grapes. We'll call it the grapes post, okay. Since the early days of WordPress, it has been possible to change the template that is used to render a post or a page on a per post or page basis. And folks will often use this to create specific custom pages or specific post styles or whatever. And it'll be a PHP file and let's actually have a look. I'm going to switch over to my Visual Code Studio quickly. I've got my LearnPress site set up in Visual Code Studio. If you haven't got the setup yet, don't worry. I just want to show you. But I want to look at an old-school classic theme. And your classic templates, let me find one quickly, they will have this template header at the top here. And a custom template, should I find one quickly? We'll normally have, yeah, it is this template name field. And that will get passed by WordPress and then cover template will exist in the list of templates you can select from. Some of you may have seen this, some of you may not have seen this. But it is a way of registering a custom template in your code. You give it the template name and what post types that it can be enabled on. And then when you're editing a post or in this case, or a page, you can select the cover template as a template type. And then it'll render the content based on the template. So that's the first kind of custom template we're going to build today. It's specific to a specific use case. It's only going to be applied specifically to posts and that's important in a second. And it has a certain layout and it'll only be used in one place. So we're going to switch back over to WordPress now and I'm going to pop over into the editor. Now, Martin, was it, I think it was Martin or somebody was asking me about the beta version in a second. I can't remember who it was, it was Martin asking about beta. So the editor is currently marked as in beta in WordPress. It kind of probably shouldn't be because I don't consider it a beta product anymore. But basically they're saying, it's not 100% finished yet. There's still changes in future improvements and things like that coming. But as far as I'm concerned, it's not a beta product anymore because it's fully formed and fully functional, it works really well. But the WordPress contributor team have decided to include that little beta thing there. I don't know the reasons why we can go and discuss that another time but that's just what it is there. And that's irrespective of whether you have Gutenberg installed or not. So in the editor, covering off the bugs could very well be. Let me go back one step and now I need my theme that I was busy developing. So I'm going to, I've already downloaded that WordPress workshop theme that I had installed. So I'm going to add this now and I'm going to upload it from my local environment. So if you've downloaded it already and you haven't installed it, now's a good time to do it. It's going to be here. So there we go. It's my Let's Code workshop theme. I'm going to install it. You know, Martin, it's funny. You say that about covering the bugs but WordPress itself has bugs in it and WordPress isn't beta. So I still don't know why they decided to call it beta. Every piece of software has bugs. Okay. So this is my Let's Code workshop theme. If you've installed it previously you'll notice that you may have noticed the screenshot has changed. I realized that naming the screenshot image with whatever the workshop is is not a long-term good idea because every time it changes I need to update the screenshot. So I'm going to leave it like that for now. But I'm not going to switch over to my code editor. I'm using Visual Studio Code for this session. You're welcome to use whatever your version of code it is. And I'm inside of the WP content folder. Inside of that I'm in the themes folder and then inside the Let's Code workshop theme folder. That's where I am right now. And what we have in this theme is we have, as always we have a style.css file which just includes the theme information. We have a theme.json which includes some settings and some styles already. If you haven't seen theme.json before there are some sessions that we have done on this before so I highly recommend going and watching those. It has a screenshot. It has a readme file. It has an index.php which has no content because that's expected. And then it has three templates. So it has the primary index template which just includes a query loop. It has a page template which just includes the title featured image and content. And it has a single template for single posts which includes a similar title featured image and content. It has a header template part which is just the site name and the navigation. And then it has the foot which just includes the part probably powered by WordPress. If some of this looks familiar it's because we've done it in previous sessions. If you joined us, join me in previous sessions we would have created these files. So let's do a quick overview of what that looks like in the front or at least in the editor. So with my theme active this is my index page as I mentioned earlier. It just has, let me pop open the list view. It just has the header template part, a group with the query loop. That's it and the foot template part. That's all that's there. The page template just has the header and then it has a group which has the image and the title and the page content. That's the post content in this case. That's all that's there. And then the single is again just header image, title, content. And then I've just got this post meta at the bottom which is post date, post author category. So these are all blocks that will render things differently on the front end. And then right at the bottom, the foot, that's all that's there. So there's the layouts in the content. This is very simple, not too advanced, but very straightforward. Okay. So I want to now create a custom template specific to one post. So in WordPress 6.1, if I go over to my templates list and I click on the add new button right at the bottom of this list and you should see this if you have Gutenberg installed and active. There is the custom template option. So this is custom templates that can be applied to any post or page. And that's exactly what we want. So I click on custom template and I'm going to give it a name. And the name doesn't matter too much. I'm just, I'm going to see in that dropdown later. So I'm going to call it the featured author template. Okay. And I create that template. Now notice what it does when it creates the templates. Automatically it pulls in the content from one of the other templates. And in this case, I'm pretty sure it's using the page template because you'll notice that it doesn't have the post meta at the bottom, which we saw in the single. So by default, it takes the page template and it pulls that it doesn't know what else to use. It says, fine, I'm just going to assume you want something along these lines. So it gives you something to work with, which I quite like. I don't like starting with a blank sheet. I like starting with something. So this is kind of cool for me. So to create this template, I don't specifically have any requirements today. You are welcome to go ahead and edit this template however you want to do it. I think it's going to be fun if you do. What I'm going to do is I'm going to be very boring and I'm just going to center align the title and I'm going to move it above the featured image. That's it. I'm not going to do anything else because I want to do some more interesting things later on with different templates, but that's all I'm going to do. And that's how I'm going to know whether or not I'm seeing the featured or the not featured. But then I realized that not all posts have featured images. So it's going to be kind of difficult. So what I'm then going to do is I'm going to just below the group that contains the title and the image. I'm going to add insert after. I'm going to add a row if I can split it. And inside of that row, I'm going to add it's putting it after. So let me just put it inside. All right, sorry, I'm not a row, not a row, a group, group. That's what I want. Inside of that group, I'm going to create the following. So just remove this guy. Okay, so inside of the group, I'm then going to add the row. There we go. Inside of the row. That's what I'm going to add the post author. There we go. And then next to the post author, I'm going to put the post debt there. Okay, so let's go back a step. So I move the title above the featured image. That was the first change I made. Then below the group that contains the title and the featured image, I added another group. And inside the group, I added two rows for looks of it. That was unfortunate. Let me move that up. There we go. I don't want two rows. I want one row. There we go. So one row. And then inside the row, I had the author and the debt. Now, if you're wondering why I'm doing group and then row, it's because group allows me to do certain alignment things or remember from pre-decision. And a row allows me to do certain justification things. If you remember, we did that in the previous session. And so what I'm going to do is I'm going to use the change items justification option in the toolbar. And I'm going to send to them. There we go. So now when I see my featured post title at the top, featured image, author date, and then the content, that's very different to my single template. My single template just has featured image title and content. So that's how I know. And then the meta at the bottom as far as I remember. And that's how I know how things are sorted out. Okay. Carl says, how did I add the row? Awesome. Let's pause there. Let me delete this whole group and we'll start on. So let me do that. Okay. So with this blank screen, the first thing I did was I clicked on the list view because I find the list view a lot easier to navigate the editor. This is the group that contains all of the content, the title, featured image and all of that. And it contains a group within a group. So it's like container div within a container div. And I want my row inside of a group just after this first group. So I click on the three dots on the left of the group and I say insert after. There we go. It pops up the power, I'm pointing to the screen like you're here with me. It pops up the paragraph just below. And then what I can do is I can either in here I can start typing or I can use the block insert a button to change it to a group. I prefer the typing option because it's quicker. So it's slash and you type in group. And then you'll see it'll change that paragraph in the side to group. And this is a group now. Now I'm doing this wrong. Or am I? Can't remember. And then I was in search after doing this completely wrong. Sorry. There. And then what I did was I moved the row to be inside that group, which I'm not gonna get right now, am I? Oh, sorry. That's what I did. Okay, let me go back a step. Let me go back a step. So it was inserting the row first. That's what I did. There. And then you'll see I can change it here to a group. Now, the way I did it first would probably be ideal. It's could be a bug. I'm not 100% sure. But a row I can say, select the group. And now I can add post author and then I can add post date. There we go. So I select the group and that allows me to add the post author and post date inside of that row. So let's go back one step. Let's remove the row. So inside of this group, so there's the top level group and there's the second group. Inside of there, we're gonna select it. No, not that one, that one. There. I'm showing off what I don't know yet. There. So insert after row. There we go. And then select the group that the row belongs to. Now changes it to this plus. Then we can go post author and then I click on the row again and you'll see the little plus comes up and then I can go post date. Okay. Hopefully everybody's along with me there. I apologize for rushing through that. But there we go. So then I've got group. Inside of the group, I've got another group with a title and the featured image. Inside the top group, I've got the row and the row gives me the author and the post date. Now, the reason I'm using a row here is because I want that option to justify things. So if I select the row here, I can use this justification option here and I can justify set. Now, whatever you do today doesn't matter. You don't have to follow what I'm doing. I'm just showing you some changes that you can make. But the point is I now have my custom template set and it has a specific layout. If I now save this, it'll say, do I want to change, do I want to save these changes? Yes, I do. And it'll save this to the database and now I can apply this template. So let us go over to posts and we'll pick John's first post. And then we can say on the right hand side of the post, you see the default template is the single template. That's how posts should work. But I'm going to click on that and I'm going to say, no, I want to change it to the featured author templates. I want this specific post to use this new template I've created. And I'm going to update that. So the quick and easy way to check that is to browse to my site URL slash author slash John do. So I'm going to browse to that. I won't see any major changes except for the theme changes. But if I look at the first post, which is the one that I've applied this feature or the post template to, and I look at the second one, I should see some differences. So the first one, there it is. It's got the title, it's got the author, it's got the date, and then the content. And I look at the second one and the second one is just the title and the content. So there I see my template has been applied. Okay. Lobsang says, I don't see functions PHP in your theme. Where can I register custom post type or style without functions PHP? Okay. That's a whole different conversation. But effectively you can just add a functions like PHP to a block theme. You don't have to, but you can. And then you can use it to register custom post types. Your styling happens in your theme.json, which if you look at the theme here, this is the theme.json file and you create settings and then you apply those settings as starts. If you haven't seen theme.json before, there's a few workshops that we've done on WordPress TV about how theme.json works, but you can also apply it in your style.css if you want to. So that all works as per normal in a block theme. Okay. Right. Getting back to custom templates. Are there any questions around creating a specific page or post templates and how to register it in the editor and how to use it before we move on? Okay. I said this was a lot to do. So bear with me. Kurt says, sorry to be behind, but what templates did you choose to start with? Kurt, I'm not quite sure what you mean there. Do you want to maybe elaborate, unmute and elaborate? Yeah. In the beginning, when you click the button to say, I want to add a new template, when I did it, I got a different base template. I didn't get the one I thought I was going to get. Okay. So when you, so you were trying to go through the process. If you could just do that first part of adding a new one. Okay. So when we're here in templates there and then when I click add new. Right. So did you not get the custom template option at the bottom? Right. I didn't see it. Thank you. That's all I needed. So that was probably, so if you want to see that, do you have Gutenberg, the plugin installed and active? Yes. Interesting. Because you should see it as a Gutenberg. I just didn't see it. It might have been there. I just didn't see it. Oh. I missed where you said to do that and that's all I needed. Thank you. No problem. No problem. Glad I could have. Yes. So for everybody, that is a new thing that is coming to WordPress 6.1. You'll see, I was talking to you earlier about primary templates and secondary templates. So you'll see all the primary templates are here, front pages here, the pages here, the archive is here, the search 404 and the single post is here, as well as the author category, date tag and taxonomy, the secondary templates. So those are all available when you're adding templates in the site editor. But now there's a new one coming, this new option of custom templates so that you can create any kind of custom templates you want. Okay. Awesome. Thank you for the question. Okay. So we've created this template and it's sitting in our theme now, in our database in the theme, should I say. But if I want to package this theme and send it off to somebody, it's not going to be sitting in the database. I want to put it into a theme fund. So the name of the file doesn't matter too much, but I'm going to just call it featured hyphen author hyphen template for now. So what I'm going to do is I'm going to pop over to my text editor and in my templates folder, I'm just going to create a new file and I'm going to call it featured author template.html. And now I'm going to want to get all of that content from that template into the spot. Now, there's a few ways you can do this. If you've used the create block theme plugin, you could use one of the override options there to do it. Or you can just do it the manual way, which is what I'm going to do today. I'm going to go into my template and I'm going to click on the little three dots, the options, the top right of the site editor here or the template editor, should I say. And I'm going to just switch the code and it's on. And then I can just literally copy all of this block code out and I can pop it into my template. Once I'm done, I'm going to save the file and then I'm going to pop back over here and I'm going to refresh this page. And now you'll see it's got two templates. It's got the featured author template all in uppercase or at least camel case or normal English case and then the one that I just created. So that's a little bit of a problem. And the reason it's doing that is because the theme.json file or at least the template, sorry, the theme hasn't registered the new template to be tied to the title of featured author template. So to do that, what I'm going to do is the following. I'm going to delete my custom template. Okay. So I've now got the file and then I'm going to register this template in theme.json. So back over here in my theme.json file. Doesn't matter too much where I do this. I'm going to do this right at the top as a new top level mode. And I'm going to use the custom templates value or key, should I say. So what this does is this allows me to register any custom templates for my theme. I'm going to open curly braces. So it's a singular item because you can do multiple. So you use the square braces to say this is an array of things. And then you use curly braces for each one. And I have three fields that I can enter. The first field is the name. The second field is the post types that it belongs to. And the third field is the title. Okay. So the name is also known as the slug. It's all lowercase hyphenated. It's kind of the unique key for this template. And I'm just going to keep it simple. I'm going to say featured author template like that. Can't spell today. The post types. Well, I only wanted to be available on posts. So I'm just going to say post. If I wanted it on posts and pages, I could go post and page like that. But I just wanted on posts. And I could then use multiple. If I have multiple post types registered, I can apply those in a combo delimited list. And then the title is the English language wording. So in this case or English, whatever language you're working in, featured author template, for example. Once I've done that and saved that file, if I go back and refresh over here, there's my featured author template. It belongs to my theme because I've registered in theme JSON. It has the English or whatever language I'm working with name. And I can then use this template and it'll still work in my site. Jeffrey says, and if you want to be able to use it on every post type, you just don't provide the option in theme JSON. I think it's actually, I'm not actually 100% sure on this, Jeremy. So I have to double check, but I think it's actually the other way around. And the reason I say that is because it defaults to page, I think. So if you want it for every post type, then I think you have to, Gina, we'll go back now. I think you have to specify which post types it can apply to. Okay, let me go back to theme JSON. So just to recap, right at the top, I'm setting it as a custom top level element. My mouse has gone missing, there it is. It's custom templates in quotes. If you're using, let me just scroll down for a second. If you're using the schema that we've covered before, the schema link, it'll auto-populate some of these things for you. But if it hasn't, in fact, I'm trying to paste this into the chat so that folks can copy this as well if they want to. So there we go. So it's custom templates. I use the square braces to open up because it can be an array of more than one template. And then each template is using the curly braces because that's an object in JSON. And then each template has a name property, a post types property and a title property. Again, you'll see the square braces, the square brackets for post types because I can do multiple post types. So that's again showing an array. In that case, just an array of string values. And this is one of the areas where if you haven't seen JSON before and you're not used to the format of the square brackets and the curly brackets and all that kind of thing, you'll have to get used to that. But whenever there's more than one item in a list, it's always the square brackets for an array. And then when it's a singular item within a list of multiple items, it's the curly brackets. Okay, I can leave that for a second. While I sip a coffee again, then Jean, once you've got that and you're happy, please give me a yes or a radio or something like that. Awesome, okay. So we can create a specific template to be used in a specific use case. You'll remember I showed you the template in 2020, the cover template. It had that template name and the template post type. That's exactly what we're doing here in Theme JSON, giving it a name, applying post types and then the only other thing we need to do, so this is where it gets confusing for me, is in classic templates, they call the template name and that was the human readable version. In Theme JSON, they've decided to call it title. And then the slug, which in a classic template is actually literally just the file name, which is used as the file name, they've called that name. So that's a bit confusing to get used to, but post types are just post types. But that's how we set it up in the Theme JSON. Now, interestingly enough, I had a conversation with another contributor recently, and he was saying, he's actually opened a ticket in the Gutenberg repository to say that custom templates and custom template parts really shouldn't need to be registered like this in Theme JSON because then the templates are so tied to the Theme JSON that you couldn't, for example, take that Theme JSON and just plonk it down into another theme and apply the settings and the styles there. And he's right, I agree with him. But this is just the way things are done currently. In the future, there might be, I'm guessing, maybe some kind of header commenting that you would do on a per template basis or some other way to register custom templates, but for now, it's done using the custom templates object inside Theme JSON. Do you need to reconnect the post to this new custom template you created? Good question, Andy. Let's find out. So let's actually go and see it, see if it works. So let's go and find, I love questions like that because it's things that I haven't thought of and we can then test it. So let's find that first template and see what happens. It broke, okay? So there we go. So now we know we need to apply it. So let's go back into the post and you'll see it switched to the default templates. Because we changed things, WordPress went, I don't know what to do. So we need to reset it. And we go back and we say, no, use the featured author templates and update that and then view that. And now it's working. So Andy, excellent question. Thank you very much for that. The reason that's happening is because the first time we saved the template, we saved it into the database. And so WordPress knew once we applied it to the post, WordPress knew that it was looked for that template content in the database. Then we deleted it from the database and we recreated it in the theme itself. But now WordPress has lost that connection. So that's a good point. When you're registering custom templates and you're testing them out, make sure that if you applied while you're testing and then export that you reapply as needed. Now remember as well, if you're building this for a client side, the chances of you building on the site are very low. You're probably gonna build locally and then export and use on the client side. But it's a good tip. So thank you, Andy, for pointing that out. Yes, Jean, you will have two. That's because what we did was when we created the new one, we went back to the templates list and we deleted the one that was created by the theme. So find the one that isn't attached to the let's code theme workshop in your template list and click on the little dots on the side and delete it. And that'll delete it from the database. Let me know once you've got that right. Eagle says, my new template has no blocks in the visual editor. Did you copy the content out from the built templates into the file? Which is the step that I did over here. If you didn't do that, I'm gonna copy this content for you and just pop it into the chat. If you did do it and there's content in that template file and it's not showing up, there might be a bug in there somewhere. So maybe have a look at what's going on there. But if you copy this content from what I just posted in the chat into that file, featured author template.html, it should start working for you. Let me know how you go with that one. Eagle. Yes, Gene, remove the one that is... So when you look at the list, you... I don't want to be able to do it now. Possibly, you should have one that isn't. So you'll see all of these are tied to the theme, but then you'll have one that'll be your username. I think it's created by username, added by username. Delete that one. Okay, while Gene's doing that, I'm gonna... Okay, Gene's up and I'm ready with this. That's great. Okay, so now I wanna talk about specifically, I'm gonna go back to that screenshot of the template hierarchy. Now I wanna talk specifically about one of these variable templates, one of these are... Here I am again, pointing at the screen, like you folks see over here. One of these orange variable templates. And we're gonna use the author nice name one. So in other words, the archive list, when I look at the posts for a specific author. So it's this author, John Doe, URL, the file it's going to be looking for is author hyphen John Doe in RKS.html. So the first thing you will have noticed when we clicked on add new earlier, is there is no option to specify that kind of variable template. There's the primary templates and the secondary templates and the custom template and that's it. I need WordPress to know that this is going to be one of those variable templates. And the way I do that is specifically by the file name. So I'm not going to create it in the editor first. I'm gonna create the file first based on that name and then I'm gonna populate the content. So if I go over to my visual code editor, in my templates, I'm going to say, create a new file and I'm gonna say author hyphen John Doe.html. So it's author hyphen and then the nickname of the author. In my case is John Doe, in your case, it's whatever you call to author. Now it's an archive list. So I'm probably going to need to use either the archive template, which I don't have in this theme. Or if we look at the template hierarchy, the full back to archive is index.php or the index.html. So that's the one that I'm going to want to use. So the way I like to do this is I like to just copy the code from the index.html template and paste it into my author hyphen John Doe, nice name template. So it's there and it's working. Now you could code this yourself if you know block markup and all those things. I don't. So again, I like to copy from an existing template that is along the lines of what I need in this case index. So if I had one in archive and then I go into the editor and I make the changes I need to do. So that's the process that I like to follow. I find it works well for me. Because I'm still not able to code block markup just from knowing it. So the next thing I need to remember is that I need to register this in my theme.json. Or do I? So listen, I want to not register in theme.json. I want to show you folks what happens. Because it's important to understand whether you need to register or not and why you would register it. So if I go back into my list of templates in the editor and I hit refresh, there's my wolfage.json.do template. And you'll see it's added by the let's code theme workshop because it's a physical file that exists in the theme. So the question is, does it work? Well, to test that, we need to be able to edit the theme of the template. So here's what I'm going to do. I'm going to click on the template to edit it because I had the code to switch down. I'm going to switch it back off again. I'm going to make some changes but I'm not going to save them. And the only change that I'm going to make is I'm going to click on the list view. I'm going to click on the group because I would have copied that over from my index.html file. And then once I've clicked on the group, I'm going to click on this layout option on the right-hand side of the block here in the block settings. And I'm going to change the, I'm going to enable that button so that I can specify my own content. And I'm going to make it a very narrow content. So it's obvious to me that this template is firing. So in my case, I'm literally going to make it something silly, like 350 pixels. So it's super, super narrow. So the user's test to say, well, is this doing what I need to do? So now what I'm going to do, I'm not going to save this, but I'm going to switch on the code editor. And you'll see there, the group layout has been constrained to 350 pixels. And I'm going to grab this code, just command or control A to grab all of it. And then command or control C to copy. I'm going to switch back to my editor, which is where my author.john.html is. And I'm going to paste that code and overwrite what was there. I'm going to pop this in the chat as well, if anybody is wanting to grab this, instead of trying to copy it out themselves. And for some reason it's not copy pasting. Maybe it's too long. That's a note. Yeah, it's just not pasting. Great, here we go. No, it's just not pasting. I think it's too long for the chat. So I apologize for that. But basically, let's go back a step. So in the code editor, once I copied the index code into my archive, to my author archive, I selected the group. I enabled this inner contact blocks use content width, and I changed the content width to 350. All that did was it's added this to the first group. So if you want to, you just want to grab this code, apply it to the first group in your new template. You can use that there. So now I'm going to exit the editor. So the changes haven't been saved to the data. So when I come back into the editor, I should see that that template exists. And let's go back to the template list. The template is there, and the template has the constraint that I need. And if I click on the little dropdown, there's no customizations that need to be changed. So it's purely loading it from the file, from the theme file. Let's see if this worked. So if I go back to my author slash John Doe URL, which is the archive list by the author name, and I hit refresh, I should see the change. And there we go. It's worked. So what does that tell us? Number one, it tells us that the template hierarchy doesn't need the file to be loaded in theme JSON with a nice name for it to work properly. WordPress doesn't care about whether it's registered in theme JSON or not. All WordPress cares about is whether the file exists in the right location. The only time that that theme JSON section is needed is if you want folks to be able to select it from a dropdown somewhere, like from here, this template location. So number one, but also it's useful when you're looking at the list in the template list to see that it's not just the template slide but actually the name. So that's another reason why you might want to register. It just looks meter and cleaner, but it's not required. You can just add it as a file without registering the theme JSON and it will just work the way it should. So that was a cool thing that I discovered recently. But I'm gonna register it anyway, just because I'm like that. So I'm gonna create a new one over here and I'm going to say the name is author nice name. Is that gonna work? No, it's not gonna work. It's gonna be author John Doe. Specifically, it needs to be the slide that's applied. I need to apply it to post post types. I'm talking nonsense here. No, it's archives. I think it's posts. And then I need to give it a title. I don't think the post type actually matters because it's a archive template. So I'm gonna actually just leave that out. And I'm gonna say it's the author John Doe archive template. And if I save that and pop back over into my editor. So just all it does is just makes that look nicer. And then the rendering should still work the way I expected to. So there it's rendering the way I expected to. Okay. Andy says, is it possible to add a description to the custom templates in theme JSON? Andy, the answer to that is not yet. Let me show you quickly how I know that. So the schema URL for theme JSON is right at the bottom of your theme.json file. If you open that, I'm gonna copy and paste into the chat so you can open that as well if you would like to. And if we pop that open in a browser and research for custom templates, you'll see that the properties over here currently only include name, title and post types. So those are the only three properties we can specify for custom templates. I'm assuming at some point in the future they will add maybe a description. You'll also notice that the only required fields are name and title. So those are the ones we had to use for this to be registered. And we didn't have to worry about post types because we're using it for an archive anyway. Okay. Gene says, would keeping the custom themes that are credited to user be left as that and then export the theme to a new theme? So the registering with the theme name is not needed. So when you export, depending on how you export, if you export using, let's go into the editor, if you export using the built in site editor export option, which is this one, where is it? No, is it this one? Can't find it now. There it is, the export option there. Then that's going to export all the same data to files. And so those will always be in files when it's installed in a separate place. And what that actually does is it doesn't register those custom templates in theme.json. It just creates the files. So the only time that your templates that are applied to a user would be if your user, let's say you've installed them on a new site and they then make changes, then it would be applied. So let me show you what I mean by that. So with this custom using the plugin I left, yes, exactly. I'll talk about that in a second. With the Hondo Archive here, for example. And let's say now this is my user on a client site and the user started to know I want this to be something even silly, 250, right? And they hit save. Now watch what happens. In the template list, it shows that it still belongs to the theme, but you see that little blue dot there? This template has been customized. So it doesn't change to the name. It shows it has been customized. So when it's a theme that exists a file and the user changes it, it shows up. If it's just been created in the editor without using any files, then it's saved the database and it's shown added by the admin. So you can check up on your users. Are they missing? And then you'll notice as well, if you can then say clear the customization. So to leave everything in the database and just use what's coming from the theme files. If you're using the create block theme plugin, the one that Gene is talking about, when you do the export, it'll do the same thing as the site editor export. It'll create the files. And I don't think, I actually have not 100% sure, but I don't think the template in theme JSON. I think you'll have to say you will have to have done that yourself first and then export to then get everything working. The registration for templates, for custom templates is really just more about visually how it shows in the editor and less to do of that actual functionality of how things work. As you saw earlier, as long as we have the name correct, the file name based on the template hierarchy, it's just going to work. Okay, I hope that answers your question, Gene. Awesome. Okay. So we've created a custom templates to use on a per post environment. We created a custom template specifically for one of the variable templates in the template hierarchy. The last thing I want to just cover today quickly is custom template pots. Now, custom template pots are very useful if you need to create reusable components in your theme. And one very common reusable component that you might need to use, especially if you're working with a theme that has a lot of posts, is a comment template bot. So it's just a list of comment blocks or however you want it to be laid out and you can just pop it down anywhere you want to. And what I want to show you is I want to show you how it adds it to the code in the site editor and then how you would have to export that into your various places. So if you go to template parts in the editor and you click on add new, it gives you three options, either it's a general template part or it's a header or a footer. Today we're working with general template parts because you want to use it anywhere across the site. And I'm just going to call it a comments part, for example. And then all I'm going to do for this template part is I'm going to add in the comments block. We'll just call it comments, there it is. And you'll see comments is a whole thing on its own. It actually is a block that has a whole bunch of other blocks in it. It has a comments title block. It has a comment template block, columns blocking inside of that with more columns and more content. The comments block is actually a really good example of inner blocks, so blocks within blocks. You could just use the comment block all over the place, but let's say you wanted to add some functionality. You wanted to add maybe an image at the top of your comments every time or something below some customization. Then you could do that with inside a template part. So I'm going to save this and there it is. And now I can reuse it anywhere I need to. Problem is I don't have, how do I get this into a file? What do I do with it? How does it work? How does it work with the table hierarchy, et cetera, et cetera. Well, basically it's the same as templates. What I can do in my editor, I can say, right, I want to create a new part. And I can literally just say, I want to call this a comments part, HTML. So it's the same basic name as the one I just created in the editor. And then I can do the same thing. I can switch the code view. I can copy this all out. And I'll put it today. And what will happen if I do that? So now I've got a saved file and I've got one that was saved to the database. Well, let's refresh it as I don't see. Come back. Using my voice here today. And I go to my template parts. I'm getting exactly the same functionality that I got the templates. I have the comments part that was stored to the database and I have comments hyphen part that is my file. So I can add either all of these to any way that I need to. So let's go and see what that might look like. So let's go into the single template, for example. And let's go right at the bottom here, just below the meta. So I'm going to switch on the list for you. And I'm going to select that bottom group. And there's a group below that I'm just going to delete for now, because I don't need, actually I'll leave it there, doesn't matter. But after that group, I'm going to say insert after forward slash and type in template part. And you'll see comments part and comments part A and B are both available. So I can choose either all. And I'm going to show you what happens when I do one over the other. So if I add the one that I added as a fun. Okay, there it is. Let's see what this code looks like. So we switched code editor and go right down the bottom here. And there it is. WP template part, the slug is comments part. So it's the same as the file name. The theme it belongs to is let's code workshop theme. And it's just in any un-categorized area. Okay, and that's basically how it adds it to the tables. Now I'm going to remove that. And I'm going to add the one that was stored in the database and show you the difference. So let's insert after, let's just go comments. And there it is comments part, for example, same structure, because it's the same code. But let's see the difference there. And we scroll down and you'll see it's exactly the same slug and exactly the same theme. Just the one is stored in the database and the one is stored in the file. WordPress doesn't know the difference. It doesn't know what to do with it. Now, what, where it's getting interesting is if I now register this in the theme JSON, it'll then always take the file first and load the file, but then it'll still look for the one stored in the database and use that over and above the other one. So my recommendation is the same way that we created the author nice name, template is created in the editor. Don't save it and then copy the code into your file. If you understand what I'm saying. So let me go back one step. Let's delete both of these, delete that one. So we're back to there. I'm gonna go back over to here. I'm gonna delete this file. There it is. So when I'm creating a custom part, my process usually is, first of all, create the file. So comments part.html. Then to make things easier for my eyes, I'm going to register the custom template part as well. So just like we create, we register custom templates, we can register template parts as well. Template parts use the same array and object notation and they have an area and name and a title and the only two that are required a name and title. So name will be comments part and title will be whatever I want to call it that's in a human readable format. So let's just say template part for the sake of being different. Why am I getting an area? Coz. I'm a celebrity, title, there we go. So name, comments part, title, comments template part. Good to go. So now if I switch back over and I refresh, I'm going to expect to see human readable English, in my case, which is great. It belongs to my theme because it's a theme that I want to ship to somebody else. Now I can edit this and I can then go crazy with whatever I want to add. So in my case, I'm going to say comments and just for the sake of being different, I'm going to add an image above it. Actually, no, let's add something else. Let's add a quote, just for the sake of making it look weird. Let's say quote and let's say sees the day and the comments below that, which is there. You'll notice that it doesn't make it nice and long and why I don't know why it's doing that. I think it's because of our template parts work. But if I then edit this in the code and there's all the code, I can copy this out and then pop it into my comment part and there it is good to go. So I can edit it in the editor, I get it to look how I want. Copy that code out and now I can use this part anyway I want. So I'm not going to save this. Going to just refresh the templates. So it doesn't store it to the database. So there's my template part. There are my templates and now if I go into single, now I can say, right, I want to add it to the bottom here. So we'll look at the list here. So we'll pop it in after the group and we'll say I'm in template part, which is great. But again, I don't want to save this. I want to copy this code. So I will just go code editor and I will find it. It's this template part and it's just inside of the last slug. So then what I would do is I would go into my single and now I'm going fast, I apologize, but I want to make sure that everybody can see this. And inside the last group, I could then just pop in the code for the comment template part. Now, some of you are probably going, man, that's annoying and irritating and lots of different things you need to do and why? And I agree. And that's where we come back to my favorite plugin, the one that Gene mentioned earlier, the create block theme plugin. With the create block theme plugin, I would do everything in the editor and then I would just export the changes. So I would create the parts, I would create the template parts, I would create the templates in the editor and then I would export the changes. The only problem is that with the variable templates, I would need to create those files first because they need to be that specific name. So the recommendation that I have because when you, I'm not going to show you now, but when you export custom templates and custom template parts, they have a WP template part prefix. And so then you have to register them correctly and that's what I wanted to show you today. So it's something that is still evolving. I'm sure that as the block editor improves, this process will improve. At the moment, just the fact that I can design the templates in the editor and then just grab that code and stick in the file to me as a winner already anyway. I don't have to write it all myself, but it's good to understand when you're creating these custom templates and template parts, what is the good process to follow? So to wrap up, the good process to follow is create the file first. So if it's a custom template, create that file with whatever slide you want. Then load it in the editor and edit it in the editor and put all the content in the way you want it. Then grab that code and dump it in the file. If it's a variable templates or a primary or a secondary template, same thing, create the files first so that they will be available in the editor, edit them, add your content, do whatever you need to do and then grab that code up. Well, Edwin says, what does it mean when in templates or template parts and the icon added by has a blue dot? Okay, good question. We just covered earlier, but it's good to cover it again. So let me show you quickly. So here's a bunch of templates that I have. You'll see none of them have the blue dots because they're all just being loaded from the file. If I click on one of them and I make a change, so let's change this to say 250. I hit save. So now this is a user editor change. So this has been distorted in the database. You'll see that now it has the little blue dot, which means this template has been customized. So the blue dot means that somebody has made changes to the templates in the editor and save them to the database and it's not loading those changes from the file only. It's loading from the file and then loading from the database overriding the file changes. Okay. Cool. I know that was a lot today. Normally I do a lot less, I'm a lot more focused and that's because custom templates is still something that is, I would say, being worked on actively. Create block theme helps a heck of a lot with this, but you still need to do some manual stuff. So I hope that you've learned today how to work with these things. I did do, and I'm just mentioning this very quickly, I did do a live stream on Tuesday about this process and I want to create a new tab and then bring it on screen while I find that URL. So give me one second here. Now I can't get things to work the way I want to. One reason my browser window dragged off screen, it's not working. Here we go. So run, yes, this lesson will be available to view later. All of these sessions are uploaded to WordPress TV afterwards and then what I do is I post the link to this session in the meetup.com event so that folks can view it afterwards. Sorry, I'm just trying to stop YouTube from just playing things. So I did a live stream of this process. If you want to see me kind of fumble my way through adding templates and template parts. So you can watch that as well. So I recommend watching that to kind of see me figure all this out for today and then watch today just to kind of solidify the information. But it is a little bit, I will admit, it is a little bit kind of janky in a way. So my process that I found is create the file, the empty file first that allows you to load that template in the editor, make the changes, add the content, copy from another template if you want and then save it by manually doing the export or using a plugin like create block theme to manually export those files. Okay, Martin, that's a great pleasure. I do hope that has been helpful. It's one of those things. So for those of you who don't know, I'm actually in the process of working on a course on block theme development and I just want to show you some of the things that we will be covering in future lessons so that you kind of see if there's something coming ahead. I'm just trying to find my... My... No, not that one. Hang on, I can't find what I'm looking for here. Here we go. So there's a course I'm working on. I'm going to share this link as well if folks want to follow along. But this is basically going to be a course on developing block themes. So we cover things that we have covered in these online work shows before. So reviewing templates, template parts, reviewing, exporting a theme could like create a lot. We talk about building your site structure in editor. So converting your style guide into JSON files, doing your primary templates, which we did last week. I dive into what actually happens when you save the changes. If you remember those of you who were here for that session, we used that with SQL Buddy to look at the actual changes and how they work. Then today's session, which is working with templates and template parts. So we're going to be doing a module on that. In the future, we're going to be doing a module on custom fonts, which I think Damon Cook has done already. So I might not be doing a future session on that, but the content will be in the course. We're going to be talking about theme patterns as well. I'm hoping to do theme patterns next week. And theme patterns is kind of like template parts plus PHP, which is really cool. It allows you to do things like localization and load up images and we're going to cover that next. Then we're also going to talk about global style variations. So how to create different styles that users can apply to a theme. I don't know how I'm going to manage that one because I'm not very good at styling, but we'll figure it out. And then we're going to talk about internationalization. So how you can create your theme so that other folks can translate it. And then we're going to do a session on locking down your theme, which we've actually done a workshop on before. So the module will just be based on that content. So if there's anything we'd love to ask is on this, I'm going to, if I haven't, yes I have on this issue on GitHub. If there's any questions around block development that you feel is not covered by the contents, the modules in this course, please do leave a comment right at the bottom here because I might not get it into. So please do follow along there. If there aren't any other questions, I'm going to thank you all for joining me and bearing with me today as I kind of fumble my way through this topic. As I mentioned, it is a little bit janky, but if you can use something like create block themes that you're exporting, it'll save you a lot of time. And now at least you'll hopefully have a good plan for how to build these custom templates, these variable templates and all of those kind of things. So thank you all for joining me here today. It was wonderful to see some familiar faces or at least familiar names. And I'll see you all hopefully again next week.