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.

Jquery Simple Fadeout

A cute little snippet to show a simple green bar upon a successful edit. <?php if(isset($_GET[‘edit’])){ ?> <div id=’notifyy’> Edited Successfully </div>     <script type=”text/javascript”>     $( ‘#notifyy’ ).show(function(){     $(this).fadeOut(5000);     });     </script> <?php } ?> The CSS: #notifyy{width:100%;background:#2f5001;padding:4px 15px;color:#fff;} Always,

Content Marketing Mistakes That Derail Your SEO

Don’t fall into the trap of content which won’t rank on search engines to go along with your sites top-flight graphics. All the effort and money poured into your website is for nothing if you don’t rank on a search engine. These are some common mistakes that can

Redirects & Canonical. What’s The Difference?

There is a lot of confusion about the difference between setting redirects and canonicalization. Here’s the deal. What a 301 says to search engines. Hello, Mr. Search Engine. My page has has moved, permanently, to this other address. If you will please remove my old domain from your

african american man using computer

How to Reset the SMC on Your Mac: A Step-by-Step Guide

How to Reset the SMC on Your Mac: A Step-by-Step Guide If your Mac is acting up—battery issues, overheating, or problems with sleep mode—it may be time to reset the System Management Controller (SMC). The SMC controls essential hardware functions like power management, battery charging, and thermal regulation.

contractor website design

Why Contractors Need Professional Website Design to Stay Competitive

In today’s digital-first world, a contractor’s website is more than just an online presence—it’s a powerful tool to attract, engage, and convert potential clients. Whether you’re a general contractor, plumber, electrician, or specialize in any other trade, having a well-designed website can set you apart from competitors and

A Quick Way To Kill Your Facebook Marketing

Facebook is a powerful tool. With millions upon millions of reachable users it is the social media powerhouse. Sharing content is incredibly easy and businesses can so easily engage potential customers that many businesses are putting it to work for them. There are, in fact, many ways to