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

New Mobile SIte

Head on over to livewiregeeks on your mobile device It’s our new mobile site based on Chalis iwebapp – a powerful framework that works well across the board. Livewire mobile has everything our main website has but is built for mobile devices. A custom redirect script detects whether a

reducing cumulative layout shift (CLS)

Reducing Cumulative Layout Shift (CLS)

NEED HELP REDUCING CLS? Enter Your Website Below For Personal Recommendations:   Fill out my online form. In the fast-evolving landscape of web design, one metric that has gained significant attention among developers and SEO experts alike is the Cumulative Layout Shift (CLS). Since it directly affects user

Learning how to code?

We get questions all the time about how we started doing all this. Where did we learn to code? How on earth does any of that make sense? Some people are interested in learning for themselves. It’s easy to get started, especially in this day and age. Back

WP: Adding a HTML5 Search Form

A simple script from your local Gainesville Web Designer. [code scroll=”false” language=”htmml”] <form role=”search” method=”get” class=”search-form” action=”<?php echo home_url( ‘/’ ); ?>”> <label> <span class=”screen-reader-text”><?php echo _x( ‘Search for:’, ‘label’ ) ?></span> <input type=”search” class=”search-field” placeholder=”<?php echo esc_attr_x( ‘Search …’, ‘placeholder’ ) ?>” value=”<?php echo get_search_query() ?>” name=”s” title=”<?php echo esc_attr_x( ‘Search

Product Variations – WordPress Plugins

So this is a nice little plugin – an add-on to Woocommerce called Smart Variation Images. The extension allows  you to set different images to each product variation. This is handy to display different style types to the user as they browse through your product variation choices. Each time they

Northwest Seafood has a new website!

Thanks to our killer Gainesville Web Design another Gainesville company has joined the livewire family with a brand new website! It’s wordpress so we can’t take credit for the design in it’s entirety but the layout is great and they’re very happy with the finished product. Their original