WordPress Custom Post Type Category Images : Solved

If you’re a WordPress developer, you’ve probably been here.

You want to use images for your categories, but they are custom taxonomies. Here’s how to solve that issue. We’re using a plugin called “Category Images” by Muhammad Said El Zahlan.

Download, install and activate the plugin. Now you can add images to your categories in any post type (or terms). You can even exclude post types if you want to keep things local to a single category. Now you want to display those images somewhere. There’s plenty of documentation on the author’s site but in our case we needed  to loop through the categories and display the image in a javascript portfolio plugin.

In our file we added the line:

<?php foreach (get_terms(‘v-category’) as $cat) : ?>

Where v-category is the slug of our custom taxonomy.

Next we needed to display the image and the category name.

<img width=”700″ height=”700″ src=”<?php echo z_taxonomy_image_url($cat->term_id); ?>” class=”scale-with-grid wp-post-image” alt=”” />

<h2 class=”nvr-pf-title”><a href=”<?php echo get_term_link($cat->slug, ‘v-category’); ?>”><?php echo $cat->name; ?></a></h2>

Then ending foreach:

<?php endforeach; ?>

That’s it. Displays like a champ.

More Web Design Blog Content

What is Lorem Ipsum?

Lorem ipsum is simply Latin text. Gobbledygook, essentially. Well, not really; It does have its roots in latin text from just before the BC to BCE line, so that puts it around 2000 years old. Past that, it’s gibberish.  Sometimes web developers need filler text to create web

An Accessibility Mindset

How often do you receive this response when inquiring about making a website more accessible? We wish we could devote more resources to it, but at the moment we just don’t know enough to get started. The value and necessity of making websites accessible are generally recognized. Almost

Moving Your Website To A New Host

Sometimes it’s easy, most of the time it is not. What a headache! If you’ve moved hosts and domains several times you’re probably an old hand at it; if not, you’re in trouble. You’ll probably need the assistance of someone that has some experience in this area. Choosing

Getting Accurate Shipping Rates

If you own an ecommerce store and provide real time shipping rates you have likely encountered a long list of issues with returning accurate rates. If you have not, Bravo good sir or madam! You are the exception. Having real-time shipping rates on your online store is a

Google Removing Anonymous Reviews

So it appears, as far as Search Engine Journal is reporting, that Google is removing anonymous reviews. And, honestly, why wouldn’t they? If you’re going to write a review you should have the guts to state your first name … or take the time to create a fake