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

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

Even More Internet Marketing Success

We’ve been working with attorneys all over town. None more than Fisher, Butts, Sechrest and Warner. They’re great folks located over in Haile. They have a successful law firm and are enjoying much success online. When we met, they were basically nowhere online … maybe somewhere back on

CSS Animation, The New Flash?

I’ve used it, so I am not immune to the pull of CSS animation, but what are we doing here folks? Used sparingly, CSS animation is at best a small way to augment conversions (button wiggle), but at worst it is a resource hog that destroys readability and

Javascript called by PHP

Interesting little snippet. What is going on here? Livewire gives you the low down.    if($num_rowvs == 0){ echo ‘<script>// <![CDATA[ alert(“This is an alert message. I’m alerting you that you are totally awesome!”); // ]]></script>’; }   First, we’re creating a simple if statement in PHP.  Not entirely

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