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

Gatorland Kubota Has A New Website

A great new site for a great company with new ownership. Gatorland Kubota sells and services all kinds of farm and lawn equipment. A family owned and operated business there is no doubt that they want the best for their customers. After all, they chose livewire didn’t they?

JSON and PHP

Here at Livewire, Gainesville Web Design headquarters, we have had a couple of projects recently that allowed us to work with JSON and PHP. Initially it may seem a bit strange for PHP experts to want to embed javascript functionality in their code base but the two work

Good one on Sitelinks

Sitelinks also factor into your ad rank, and can influence the position of your ad on search page. Ad Rank previously took into account your max cost-per-click (CPC) and quality score, and now ad extensions and formats are another component of the calculation. Seems like a no-brainer to implement,

Maintaining Correct Site Structure

One of the biggest holes in a client’s SEO (pre livewire SEO, that is) is almost always the site structure. So many SEO companies focus on content and backlinks that quality code is often overlooked. There are many cases where we have come into the tail end of

Recover From A Negative SEO Attack

Nothing can be quite as irritating or as damaging as an unscrupulous competitor or determined unhappy client that is willing to go to any length to harm your business. It doesn’t take much for some people to launch an all out assault on your business, endangering everything you’ve

2 Great Marketing Funnel Tools

Using Outbase for Target Market Research With Outbase’s multitude of capabilities, you can gain a deeper knowledge of your sales performance and identify areas for improvement. Outbase is a prospecting platform that streamlines the top funnel challenges experienced by business-to-business organizations. Thanks to a large dataset covering numerous