Setting Up and Using Categories
Categories are hierarchical groupings of blog posts, organized by topic. They can be nested, with top-level, or “parent,” categories providing the main navigation and an unlimited number of subcategories, or “child” categories, underneath them.
Like tags, categories give users a contextual way to organize and locate the posts on your site. Unlike tags, however, categories can generally be used by your theme or theme widgets to create more powerful navigation for your site than tags can. We delve into theme development more fully in Chapters 8 and 9.
You can add and manage categories using the Categories page in the Admin screen, or add them on the fly as you create posts, just like you do with tags (Figure 4.21).
Figure 4.21 Choose one or more categories as you create your post using the check boxes to the right of the post editor.
To create and manage categories:
- Access the Categories page under Posts in the sidebar menu (Figure 4.22). You’ll see an Add Category section on the left and a list of your current categories on the right.
Figure 4.22 Your current categories are listed on the right, and you can enter new ones using the fields on the left.
- Create new categories by entering a name in the Category Name field (Figure 4.23).
Figure 4.23 To add a new category, all you really need is a name; everything else is optional.
- WordPress automatically generates a category slug when you click Add Tag, but you have the option of entering your own unique URL-friendly identifier in the Category Slug field.
- You can also choose a parent using the Category Parent drop-down menu.
The default setting is None, which means the new category will be a top-level, or parent, category. If you choose an existing category using the Category Parent drop-down menu, however, the new category will be a subcategory, or child category, of that category.
- Click the Add Category button to add your new category. New categories will show up in the list on the right, organized by
hierarchy with child categories displayed below parent categories with a dash in front of them (Figure 4.24).
Figure 4.24 Child categories appear below parent categories in this list, preceded by a dash.
To create a new category in the post editor:
- Open the post editor and click Add New Category beneath the list of your current categories (Figure 4.25).
Figure 4.25 Add a new category by clicking the Add New Category link in the post editor.
- Enter the new category name and parent (if any) and click Add (Figure 4.26).
Figure 4.26 Add a subcategory by choosing a parent category from the drop-down list.
You will see a hierarchical list of categories that you can choose from (Figure 4.27).
Figure 4.27 Your new category will appear in the list.