• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to footer
  • Skip to footer navigation
  • Services
  • Our Themes
  • Start a WordPress Blog
  • WordPress Hosting
WPArena

WPArena

WPArena covers all things related to WordPress: Themes, Plugins, Tutorials, Guides, Deals and Beginner tips.

  • News
    • Opinion
  • Tutorials
  • Reviews
    • Themes
    • Plugins
  • Comparisons
  • Collections
    • Education Themes
    • Genesis Child Themes
    • Best Responsive Themes
    • Medical WordPress Themes
    • Finance & Business Themes
    • Crowdfunding Themes
  • Resources
    • Inspiration
  • Deals
WPARENA » Tutorials

How to Add/Show Category Images in WordPress

TwitterFacebookWhatsAppGoogle+BufferLinkedInPin It

If you are customizing or designing your theme, you can link images with categories in the post. All you have to add some simple PHP code to your WordPress theme with some basic HTML knowledge and specific images for categories.
First of all, you must know about the get_the_category tag. You can read detail about what this tag is in the WordPress documentation here.

Here is the code which is a good hack for adding images to the categories.

<h3>Posted in:</h3>
<?php foreach((get_the_category()) as $cat)
    {
    $catname =$cat->category_nicename;
    echo "";
    echo "<img src"/wp-content/cat-icons/";
    echo $catname;
    echo ".png" alt="$catname category image" border="0" />\n";
    }
?><br />

WordPress Plugins for Category Images

Category Icons Lite

The Category Icons plugin is written by Brahim Machkouri, and the author has made a website dedicated to this plugin ) where you can find many more information like full documentation, FAQ’s and a ‘Troubles’ section where you can ask your questions regarding the plugin.

It’ll work with a lot of themes. Just try. If you have an issue, make sure your template has the post title preceded by the permalink and its title :

<a href="<?php the_permalink() ?>"... title="<?php the_title(); ?>">
<?php the_title(); ?>

or

<a title="<?php the_title(); ?>"... href="<?php the_permalink() ?>">
<?php the_title(); ?>

How to use it :

  1. Deactivate the Category Icons Lite plugin if it was previously installed and activated.
  2. Upload this plugin or install it via WordPress
  3. Activate this plugin through the ‘Plugins’ menu.

category-icon-plugin

Category Icons

The No. 1 plugin to assign icons to categories easily.

More Info & Download

Category Image(s)

Display an image for each category associated with a post.

This plugin provides the templates tag c2c_the_category_image() which basically reproduces and extends the functionality of WordPress’s core functionthe_category() to add the ability to display a category image instead of the category name in the link to the category archive. With its $image_extensions argument defaulted to "", the plugin could be a drop-in replacement forthe_category(). As is done in the_category(), the image or text for each category is also a link back to that category’s archive.

More Info & Download

You Might Also Like These Posts:

  • How To Add & Change WordPress Themes From The Dashboard
  • How to Customize WordPress Post Order?
  • How To Add a PayPal Donate Button To WordPress Blog
  • How to Expand/Collapse WordPress Posts with jQuery
  • How To Test Your WordPress Site For Errors
Noor Ahmad

Noor Ahmad

I am a WordPress Developer and Designer, author @WPArena. I am providing Free WordPress consultation and can help you to install WordPress in a secure way to small businesses and bloggers.

Previous Post Necessary Elements of a Restaurant WordPress Theme
Next Post Major and Secondary Search Engines and Directories to Submit Website

Reader Interactions

Leave a Reply Cancel reply

Thank you for choosing to leave a comment on WPArena. Please bear in mind that all comments are moderated according to our comment policy. Your email address will never be published but is required. Do NOT use keywords in the name field. First name is fine with us. Lets have a meaningful conversation and respect others opinions.

Primary Sidebar

Over 40,000+ Readers

Get fresh content from WPArena

Recent Posts

  • 7 Ways SEO Helps You Grow Your Blog Audience
  • ARForms Review – Best WordPress Contact Form Plugin
  • 3 Crucial Things You Need For a Successful Email Signup Form
  • Themify Shoppe Theme Review: Multi-purpose WooCommerce Theme
  • 4 Best Website Builders to Create a Personal Website

Our Services

WordPress
Installation
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store

Footer

About

WPArena is a premium online resource site of WordPress and is focused on providing excellent WordPress Tutorials, Guides, Tips, and Collections. The site design is updated at regular intervals with more features. Look here.
You can read more about WordPress Arena here.


WPArena Marketing Material

Resources

  • Best WordPress Plugins
  • WordPress Permalinks Structure
  • Email Management System
  • Envato Free Files

Reviews

  • Beaver Builder Review
  • Beaver Themer Review
  • WP User Frontend Pro
  • Ninja Forms Review
  • MemberPress Review

More Reviews »

Deals

  • Clickright Theme 30% OFF
  • Hostgator Coupon
  • ionMag Theme 30% OFF
  • OIO Publisher 20% OFF

More Deals »

© 2018 · WordPress Arena · All Rights Reserved.
We are not affiliated with Automattic or WordPress.

  • About
  • Advertise
  • Write for us
  • Disclosure
  • Terms
  • Privacy
  • Contact