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.

Don’t Get Smacked by Copyright Infringemnt

Developers do it all the time – they need an image for a website and head on over to Google images, put a keyword in and voila! Free pictures for everyone! Not so fast. Many of these images are protected under copyright law and if you get caught,

Website To Text

Introducing the Livewire Website to Text Application, a cutting-edge tool that transforms consumer engagement. Imagine having the ability to instantly connect with customers in a personalized way, bridging the gap between your website visitors and your company with ease. With this game-changing feature, you gain access to a plethora

Should you be wary of SEO firms?

Good Call Commander! You should absolutely be suspicious of SEO firms these days. The industry is unfortunately saturated with unscrupulous, downright devious companies that prey on  unsuspecting business owners attempting to better their rankings. They pump your site full of fluff and post thousands of links around their

Search Engine Optimization

More important than ever and we’re at the leading edge. One of our best success stories is Rose Petals Nursery. We’ve been doing optimization for them for some time now with some great results. We’re dominating from top to bottom. Just check out this high level, competitive keyword: Old Garden

Why are most government websites so terrible?

The recent debacle with the Affordable Care Act has made headlines but those of us in the development world are just seeing more of the same old thing. Government websites stink! Why is that? I can assure you that their cost structure is very similar to the outrageous

Why Website Speed Matters More Than Ever in 2024

In today’s fast-paced digital world, website speed is crucial. Users expect instant access to information, and a slow website can significantly impact your business. Here’s why website speed matters more than ever in 2024 and how you can improve it. The Importance of Website Speed User Experience When