Join Morten Rand-Hendriksen for an in-depth discussion in this video Adding a category image plugin, part of WordPress Developer Tips: Adding Category Images.
- View Offline
- While category images are popular and quite useful, they don't come standard with WordPress. That means we need to add that feature in. The easiest way to do that is through a plugin. Now if you go to the WordPress.org plugin directory or onto the general web and do a search for "WordPress category images," you will find tons of different options available to you. All these options pretty much do the exact same thing. They give you the ability to assign an image as the featured image for a specific category, tag or other taxonomy.
I've tested a bunch of these different plugins to find one that works well and doesn't have too much cruft. What I ended up with is this one that you see right here, called Categories Images, both plural. This plugin gives you exactly what you need. It gives you all the hooks you need to display it in your themes and doesn't have any extra features you don't need. And because it's available directly from the WordPress.org plugin directory we can install it directly from WordPress admin. So I'm going to go to my site, go to the Dashboard, go to Plugins, and Add New, and from here, search for "categories images." Once I find Categories Images, I'm going to install it.
Activate the plugin, and now if I go to Posts and Categories you'll see there's been a slight change. Now next to each of my categories, you see a little drawing of a picture. That means I can now add images to each of my categories. It's important to note that this plugin here, Categories Images, is just one of several options. Although this is the plugin I'm using in this course, the principles I'm teaching you in this course will apply to pretty much all the different category image plugins available.
So, if you want to use this plugin, great. You can follow along without any problems. If you want to use a different plugin to do the same thing, chances are, you can still follow along in this course by using the custom code that comes with that plugin. Because as you'll see when we progress forward, to use a category images plugin, you actually have to make some changes to your theme because the plugin can't intuitively know where to place those images. This gives you far more control, but it means that we need to dive into the theme to get things to work properly.