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

You get 15 seconds! Web Design Trends for 2016

Mobile is in and users are becoming increasingly impatient. In 2014, 55% of users spent less than 15 seconds on a webpage according to data by Tony Haile of Chartbeat.  This means you only have 15 seconds to capture a users attention and convert a visitor to a customer.

Our New Look

Take a peak at our main website’s new look! We’re proud to present a brand new layout and style for Livewire Web Design. We work hard on your websites, so we took a few days to upgrade ours – we added a new optimization center that gives prices

Submit A Sitemap … To Bing?

Indeed. For some reason, Bing still exists. And since it does you’ll need to submit your sitemap so your business will show up in the results of a person who searches from the unwanted automatically installed Bing bar on their browser. They’re so lovely, forcing it on you

Firefox is dead to me

That happened a long time back. Now it seems that the once beloved browser is now in the same situation with the majority of its former users. I personally feel that the browser lost its roots in version 12, but it was showing signs of becoming yesterdays news

Client Spotlight: Pye Law

Tom Pye is a heck of a guy. Dedicated to his clients and serious about his business. He chose Livewire, the best Gainesville web design team in the businesses to create and promote his online presence. We remade his website and optimized it to the hilt. In just

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