-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tutorial - Template Parts #1462
Comments
Old Script: 0:00 0:26 1:00 1:16 1:51 2:57 3:35 4:41 5:23 5:54 |
Revised: If you visit a well-designed website, you'll notice that one of its strengths is in its consistency: its headers, footers, and sidebars often have the same or very similar content to make it easy for viewers to find the information they are looking for, no matter where they are on a website. To get this effect, do web designers they have to re-create their headers, footers, and sidebars on every page in their website? The short answer is: No! With WordPress block themes, web designers use a feature known as "template parts". By the end of this tutorial, you'll be able to What are template parts? Finding Your Template Parts From this screen, you have the option to edit an existing template part by clicking the pencil icon next to an existing template part, or create a new one from scratch. Let's start by editing a header. Most headers provide at minimum the site title and navigation menus, to make it easy. From here, I can use the site editor to modify my header template: watch as I add a site logo and a site tagline to this header. Once I save it, this change will be applied to every template that uses this header. I can see this if I click on the icon in the top left-hand corner, then select 'templates'. Let's look at the home page template; you can see here that the changes I made to my header have been automatically applied to this page template. I can see which template part is being used by using my list view. I click the list view, and you can see the list of all the blocks that make up this existing page. How do you know what is a template part, and what's a standard theme block, only used on THIS template? Template parts have a slightly different icon than the theme blocks that make up this template, and will be highlighted in purple. Caution! You also have the ability to edit a template part in any regular template. The changes you make to a template part will also be made across other templates that use this theme; to avoid this mistake, always use your list view and ensure you are not working within any purple-highlighted text. What if you want a different header on, say, your home page, but you would like the rest of the website to have a standard header? In this case, you would want to make a new template part. I head back to the template parts dashboard by clicking the icon in the top left, template parts. From here, I can click the plus sign to create a new header--I name it, "Front Page Header", select the "Header" template part, and then create. This will not automatically take me to my new header, so I need to open up my menu again, select 'template parts' and then select the pencil button next to my new template part. I'm now ready to create my new header. While I can do this from scratch, I can also use patterns to help me design, which saves me time. Watch as I pick a pattern; I will then edit this so it looks the way that I want. When I'm finished, I have [describe the header pattern I picked]. I save my work, then head back to 'templates'. Removing and Adding Template Parts to Templates Now, it's time to remove an old template part and add a new one. I click on the 'Front Page' template part. Using my list view, I locate my header template part. I select the three dots next to it, and select 'remove'. I would like to add this above my content, so I select the three dots next to the top block in my list view, and select 'add before'. From here, I can either use the plus sign, or type "slash template" -- from here, I am presented with a list of available template parts. I select the one I want to create, and voila! My new header template part has been added. You can use this process to create, edit, and use other template parts, such as for footers or general other templates, such as if you wanted to create a sidebar. Remember, the goal is to design once and edit once, and have your changes automatically apply elsewhere. It's a time saver! |
Resources for this tutorial: https://docs.google.com/presentation/d/1lNL4XsE9ddiDC0O6OyX1NRi_nRJ82k6ve9sK9nAHmI0/edit?usp=sharing |
Ready for review! https://drive.google.com/file/d/1negPXsmydxQqTY4qI7qNiKiVSQkd3dVe/view?usp=sharing Specific Feedback:
Thanks, ya'll! |
Love the explanation of template parts and the graphics you used to help visualise what you are talking about. Very clever! The sound quality is good! The part where you were embedding a template part within another template part was a bit confusing at first, but it did click for me at the end. Clarifying this a bit more is a good idea. One suggestion is to slow down some of the transitions. Well done, Sarah |
This was very instructive. I didn't have any problems following along, and learned about the nested template parts (such a cool feature!). |
This tutorial needs to be updated for 6.3; I have removed myself from this issue to allow someone else to work on this. :) If I find time to work on this in the next two weeks, I will comment below and happily reassign myself to this issue. |
LP.Template.parts.mp4 |
@westnz clear and concise as always. The only feedback I have is below.
|
Thanks @digitalchild 👍 |
@westnz Nice coverage of Header & Footer template parts. No other issues noted, aside from the abrupt ending mentioned by @digitalchild Feedback: I am wondering if there's a tut or reference elsewhere (aside from docs) about the relationship/difference between templates, template parts, and patterns? That could be helpful to note. Another good one! |
Tutorial/Lessons Review ChecklistPlease tick all items you've confirmed:
Another good job, Wes. Only comment is that it ends a bit abruptly. Maybe add a last slide with sources of additional information about template parts? From your video I learned that the purple color in the list view means the content is synced. I was under the impression that it meant you were working on a template part. Since template parts are always synced, they are always shown in purple. But, as you point out, a synced pattern also displays in purple. Thanks for pointing that out. |
Thanks @quitevisible |
Thank you for the feedback @SierraTR |
Updated and published on Sensei as part of the Beginner User learning pathway. |
Topic Description
The tutorial "Template Parts" (recorded with WordPRess 5.9) needs an update - upon review, the script needs a re-work.
Related Resources
Links to related content on Learn, HelpHub, DevHub, GitHub Gutenberg Issues, DevNotes, etc.
Guidelines
Review the team guidelines
Tutorial Development Checklist
The text was updated successfully, but these errors were encountered: