I've been having lots of difficulty trying to get this icon to display by the newest added post title without much progress.
The Loop:
<?php
$the_categories = get_the_category();
if(function_exists('get_cats_icon($the_categories)')) {
$screen = get_cats_icon();
$screen = $screen[0];
} ?>
<img src="<?php echo ($screen); ?>" width="33" height="33" alt="" />
The Functions:
function get_cats_icon($the_categories) {
foreach( $the_categories as $category) {
if ($category->cat_name == "Category Title") {
echo '<a href="http://site.com/category/title"><img src="http://site.com/wp-content/uploads/icon.png" /></a>';
} elseif ($category->cat_name == "Category Title") {
echo '<a href="http://site.com/category/title"><img src="http://site.com/wp-content/uploads/icon.png" /></a>';
}
}
}
Is there any easy way to get this code to work?