Home » Experts Only » WordPress Custom Post Type Category Images : Solved

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

Facebook Dings Developers

In the ever growing app community, Facebook is putting the screws to developers looking to use their vast resources to build their apps. Really, they’re just looking for a little “reciprocity”. But come on, how much do you need? You already own and operate the largest website in

Howe Development Has a New Website

Website is complete on Howe Development. Now for phase 2 – integrating a simply, custom CMS so they can update content on parts of the site. No need for wordpress – we can easily do a custom solution for those cases where a client only needs to control

What’s New For 2015

Really, we’re not all that sure. We’ll go where the winds blow us but we do have some exciting projects to start out the year right. January will be a big month for us here at Livewire and we hope it only goes up from there. We’re glad

Sullivan Welding Has A New Website

Sullivan welding does excellent custom welding and fabrication. Willum is the owner and manages a crew of expert custom welders. He came to Livewire looking for the best in Gainesville Web Design and we were able to set him up in a great new website in just a

Garry Seay has a New Website

Garry is running for Sheriff in Union county Florida. We wish him the best of luck and he has a great new website to show off. His campaigners came to me after locating Livewire on Google. We met and discussed their needs. They needed something up and running

Early Learning Coalition Has A New Website

The ELC of alachua county came to us looking for some help with their current website. They had evidently been hacked on their Joomla installation and there were a number of issues that rippled out from that. We attempted to fix the installation but the site was outdated