For a few years I used the plugin “Category icons” to show an icon in my “latest news widget” (according to which the news-category the news-item was linked)
Example the KBC-logo in front of the KBC-news… (http://kbc.verzekeringen-portaal.net)
Now I want to skip this category icons plugin, because he isn’t supported anymore since a long time.
When using the Category icons plugin, I used this code in the “Class-Framework-widgets.php”-file:
if (function_exists(‘get_cat_icon_lite’)) echo get_cat_icon_lite();
Now I found a solution of an alternative way to show the icon, depending on the category a news-item was linked.
(link: https://perishablepress.com/ (Purchase code hidden if logged out) -for-7-unnecessary-plugins/)
A) Create a folder in your theme-folder called: icons
B) Put the png-files in that folder with the same name as the category-name.
C) Use the following code:
img src=”<?php bloginfo(‘template_directory’); ?>/icons/<?php $cat = get_the_category(); $cat = $cat; echo $cat->cat_name; ?>.png” alt=”Category Icon” />
I don’t know anything about programming, but how do I replace het “Category icons code” with this code?
This is not doing it:
echo “img src=”<?php bloginfo(‘template_directory’); ?>/icons/<?php $cat = get_the_category(); $cat = $cat; echo $cat->cat_name; ?>.png” alt=”Category Icon” />”
Can someone tell me how to do this? Get the image and show it in the echo (instead of the Category icons code)?
Or any other solution is also ok! :-)
Thanks in advance,
You must be logged in to reply to this topic.