FREELessons: 7Length: 43 minutes

Next lesson playing in 5 seconds

  • Overview
  • Transcript

2.2 Working With Categories and Tags

In this lesson, you'll learn how to add categories and tags to your posts and the difference between the two. You'll also learn how to use categories and tags in navigation.

Related Links

2.2 Working With Categories and Tags

Hello and welcome back to this Tuts+ course on creating content in WordPress with posts and pages. In this part of the course, I'm gonna show you how to add categories and tags to your posts. So here's a post I've already created, and I can now edit that by clicking on the Edit Post link up here in the toolbar. So I need to be in the document pane over here because I'm editing the document and not an individual block, and I scroll down to Categories. Now where you first set up your WordPress site, you'll only have one category and that will be Uncategorized, which to my mind isn't the best of categories. So let's add a new one, I'm gonna call it Avengers, cuz it's got that picture of Tony Stark. So I'll type that in, and I can either just hit Return, or I can click on Add New Category. And that will be added, and then I'm gonna add another one. But what I want to do with this one is make it a child of Avengers. Now, I didn't do that already, so I'll show you how you do it via the category editing screen. Now first, let's remove Uncategorized from this post and let's update it. And then to edit categories that you've already created, you go to the Categories link here under Posts in the admin menu. So here, I could add a new category if I want, which wouldn't be assigned to any posts yet. I'd then have to assign it to those posts in the admin screens. Or I can edit this one, so I'm gonna edit this. I'm gonna put a parent category of Avengers. I'm also going to add a description. So I'll go back to that category screen and I'm gonna view the archive page for Tony Stark. So you can see here, category archives Tony Stark, and then it's got my first post. Now this particular theme, which is the default theme, doesn't display my description, but many themes do. And I quite like to find themes, either that or code my own themes, that include the category description in the archive page. So let's go back to that, I'll just check that it's saved. Yeah, it did save, so it's not being displayed by my theme. So now if I go back into my post and I'll edit that, you can see that Tony Stark is displayed as a child category of Avengers. And I could also add a new one, so let's say I wanted to add, Bruce Banner. And I could select parent category again here. But I would do it when I'm adding the category in the post. Now in this case, I don't want to have Bruce Banner as a category here, so I'm gonna uncheck that. But that's another way to add a category and create it as a child of a parent category. So let's just update that, and if I view the post, You can see that it's filed under Avengers and Tony Stark. So if I click on Avengers, we just get this post. And again, if I click on Tony Stark, we just get this post. So let's click on the post, go back and edit that, click on Edit Post up in the admin toolbar. And then I'm scrolling down again, and now I want to add some tags. I'm gonna add Blocks as a tag, I'm gonna add lots of WordPressy type things. Okay, so we've got completely different types of categorization here. And I'm not actually categorizing because with a tag, you can add lots more tags to your posts, and you can add lots more tags to your site. A category is something that you would use to sort your site, and to create sections of your site that people would navigate to via the navigation menus. Tags, you wouldn't add to your navigation menus, because you'd have lots of them. So they're for sort of smaller categories that span the bigger categories. They're not categories at all, it's quite difficult to describe what a tag is without using the word category. But they're smaller ways of classifying your posts, if that helps. So I'm gonna update that post, and then I'm gonna show you how to add a category archive to your navigation menu. So to get at the navigation menus, we go to Appearance here, and Menus. Or alternatively, we go to Appearance and Customize, because we can use the customizer. So I'm gonna use the customizer, so I can see what I'm doing as I do it. So my main menu, Is currently in the primary location, and I need to add some items to it. So the Home page is there at the moment and that's the only thing. So I'm gonna add a category, I'm gonna add Avengers, I'm gonna add Tony Stark. But what I will do is, I will drag that across so it goes underneath. And if I hover over Avengers, You can see Tony Stark is underneath. So let's add Bruce Banner as well and drag that there. So there you go, I've got two options here under Avengers. And I also need to add the home page. Let's put that first cuz I haven't already got that there. So now I've got Home, that's just a single level menu item. And Avengers, I've got Tony Stark and Bruce Banner underneath. So that's how you add category archives to the menu. Now it's very important to note that, because I'm using the customizer here, until I click this Publish button, nothing I do is saved. Because the whole point of the customizer is, it lets you preview changes that you make to your site. So I'm happy with that, I'm going to click Publish. And then if I click the x here, that will take me back to where I was before, which was this post. I'll view the post to see the front end of my site, and here's my menu. So if I click on Avengers, I get the Avengers archive. If I click on Tony Stark, I get the Tony Stark archive, which obviously has got the same post in it at the moment. Now let me show you how to add a tag cloud. Now, you wouldn't add tags to your menu, but instead, you can use a widget to create a tag cloud in your footer. So let's go back to the customizer, so another way to access the customizer when you're in the front end of your site is to click Customize up here in the toolbar. So I'm gonna select Widgets, at the moment, I've got three widgets in there. I'm gonna add another one, which will be a tag cloud. And the tag cloud widget comes with WordPress out of the box, you don't need to find a plugin for one. So I'm gonna get rid of the Meta one, and keep Search and Recent Posts. And there you can see, I've got Blocks, Lists, Paragraphs, and Wine, I must have added that already. [LAUGH] So I think I'll remove Wine, but let's publish this first. That gives me a good opportunity to show you how to edit tags, so again, I'm back in the dashboard. And under Posts, I've got access to Categories and Tags. So here's Tags, I've already got a whole bunch of tags added to my site, which I added earlier on before I started doing this demo, so let's find the Wine one. Let's delete that one. Okay, so none of these have posts associated with them at the moment. But if I was to add, say, site management to one of my posts. So if I go back to my first post, and I want to add an existing tag. So if I start typing here, it will find an existing tag for me, and that helps you make sure that you don't create multiple tag archives for very similar tags, cuz that can be quite easy to do. So it's worth taking your time when adding tags and checking whether WordPress is auto-populating that tag for you. Because it's much neater if you're using the existing tags. If there isn't an existing tag that covers what you want to call it, just feel free to add a new one. That's the beauty of tags, you can have as many as you want. And you'll notice that the tags interface here looks different from categories. And that's because categories are hierarchical and tags aren't. So I can't add a child tag or parent tag, they're all on one level. Whereas categories, I can have children of my parent categories. So I'm updating that post, I'm gonna view it again. And here, if I go to the bottom, we've got all my tags listed here, and we've got my categories listed above. So if I click on one of those tags, here's the tag archive for paragraphs. And I can also access that by clicking the link here. So I click on Lists, and here's the tag archive for Lists. So that's how you add and edit categories and tags to your posts, or more generally, in WordPress. You don't have to add them directly to posts, you can add them separately and then assign them to posts later on. And I'll show you another quick tip that's really useful if you've already done that, because you can use Quick Edit to add categories and tags to your posts. So let me just come back out to that, I click on Quick Edit here in the main post screen, underneath the post. And then I can select category from right here, and then I click on Update to save it. Alternatively, I could do that with multiple posts. So I could click on Edit and Apply, and then it would list all of the posts that I've selected, and I could add a category to them. Now bear in mind, it doesn't show the categories that are already there or the tags that are already there. Because those are gonna differ depending on the different posts. So you would just need to add, so say if I had to do all of them, so if I just added Bruce Banner, it would still have Avengers and Tony Stark. It doesn't alter the categories that have already been added to that post individually, it just adds new ones when you use bulk edit. It can be quite useful if you add a new category to your site when you've already got some posts. You can quickly come in here and use the bulk actions option up here to add that category to a whole bunch of posts. So that's how you work with categories and tags in WordPress. In the next part of the course, we're gonna move on to adding some pages to our site. See you next time, and thanks for watching.

Back to the top