Build Your Own Business Website header image

How to Use Category and Tag Pages in WordPress

Difficulty Level -

Filed Under Topics - ,

Listed Under Lesson Subjects - ,

Applies to -

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

Part 1 – What are Categories and Tags?

In this session we discuss what categories and tags are and how to use them in WordPress. Categories and tags are built in methods of organizing posts. After assigning a tag or category to a post, WordPress will generate a page, called an Archive page, that contains all of the posts of those categories and tags. We also show examples of the way categories and tags work best.

Video Transcript

That is what we’re going to talk about is how to use category and tag pages or maybe, more to the point, how to use categories and tags in WordPress and then how the category and tag pages work and how it can customize those and that sort of thing.

And so the first thing really to start off with is what are categories and what are tags. Now categories and tags are built-in methods of organizing posts. So you can’t assign a category to a page and you can’t assign a tag to a page. You can only do those to posts. And the underlying rationale is that when you categorize a post or when you assign a category to a post or you assign a tag to a post that when requested, WordPress will generate a page that contains all of the posts of that category or all of the posts of that tag. And in this way, you can see you know, similar posts combined together on the same page. And those pages are called archive pages or sometimes, they’re called category pages or tag pages or category archives or tag archives. But what they are is a collection of all of the posts that share that same category or that share that same tag.

Now the difference between a category and a tag is that categories are hierarchical which means that you can have a category and a subcategory of that category and another subcategory of that category and so on and so forth. Tags, on the other hand, are not hierarchical. That is, there’s no such thing as a subtag. All tags are essentially equal and they are essentially also unrelated to each other.

So I’m going to talk about an example of using those on a site that my dear friend and designer, Kim, has been working on. It’s called the Cheesemongers Table here in Edmonds and this is a specialty cheese shop in Edmonds. And they aren’t blogging but they are using the blog function for certain kinds of things. On one level, they’re using it for announcements. On another thing, they’re using it for is essentially a catalog of their cheeses. And so this is their static front page. And let’s see, if we go look at their posts you know, they have a whole bunch of posts here. In fact, let’s just… well, they’ve got 99 posts so we’ll change our screen options so we can see 100 posts at a time.

And so they’ve got Valdeon and Two Sisters and Trufflestack and Tomme de Savoie and Tomme Bordeaux and you know, all of these different… Pecorino Romano and Pave L’Averyon and you know, all of these different cheeses. Then they’re also using this as a way of displaying sort of gifts of cheese or you know, products that they sell that are sort of a combination. So Vive La France is a group of cheeses that somebody can get. And then you’ve got the Cheese of the Month Club so they’re essentially using these posts as a means of having you know, a catalog of stuff that they sell or stuff that’s available in their shop.

And so they have an organizational system or they have a couple of organizational systems that they’re trying to use to group the cheese. They have cheese by region and then cheese by the type of milk. And so what we chose to do is to use categories for cheese by region and then we are using tags for things like… for cheese by milk. So if we look at our categories, we have cheeses by region as a parent category and then inside of that category is Australia, Basque, France, Germany, Greece. And then we even get down to USA and USA has a subcategory of Washington. You know, you could have Wisconsin and Vermont or whatever other subcategories you might have. There’s probably subcategories of cheese ultimately inside of France and then maybe inside of Germany and other places as well. And this is the way in which you see this hierarchical nature of categories displayed. The parent category is cheeses by region. The child category is United States. The grandchild category is Washington state. And so we’ve got these… you know, this is the hierarchical kind of category.

And then you’ve got a category called Gifts of Cheese which is not really… which is something essentially independent from cheeses by region and they’ve got a category called Cheese of the Month membership. And so the fact that these categories themselves are independent of each other is going to show up here when we start talking about how to display them. But this is the method of categorizing that we’re using.

And then we have a method of tagging the cheeses and right now, we just have 3 tags. We have cow, goat and sheep but there may be other kinds of tags. You know, somebody you might end up with tags like you know, soft cheese and hard cheese and I don’t know. I’m not actually that conversant with cheeses but there may be other kinds of ways of categorizing cheeses as well and in those cases, we’ll probably use tags for that kind of breakdown. Right now, we just have cow, goat and sheep.

Now the way categories and tags work best is if a post only has a single category. If a post has a multiple categories, WordPress routinely only considers the primary category and what it thinks of as a primary category is the first category that was assigned to the post. So if you assigned… yeah, if you assigned category 3 to the post and then category 1 to the post, the primary category is still going to be category 3 because that was the first one that was assigned. So that’s something to bear in mind that often, when you display posts by category, WordPress will only display the primary post or the post for whom that is the primary category. So… which is why it makes the most sense to only have one category per post and to use an organizational system that will allow you to only assign a single category to a post. And if you need to assign it more than one thing to post then you should use tags for that instead because you can have as many tags as you want per post because there’s no hierarchical system and there’s no primary tag for a post.

0 Comments… add one
0 comments… add one

Leave a Comment