I've inherited an old WordPress site that my customer doesn't want to be rebuilt. It has an old MySQL query in the functions.php of the theme that is supposed to put a category image with the category. Over time of course, WordPress has been updated and the query doesn't work any more. I'm hoping someone can help advise how I can update this. The code is:
function catImg($catId){
$data = mysql_fetch_object(mysql_query('SELECT * FROM `wp_ig_caticons` WHERE `cat_id` = "'. $catId .'"'));
if($data->icon){
echo '<img height="158" width="121" title="" alt="skyway" class="attachment-post-thumbnail wp-post-image" src="'. site_url() .'/'. $data->icon .'"/>';
}
else{
echo '<img height="158" width="121" alt="no-image" class="attachment-post-thumbnail wp-post-image" src="'. site_url() .'/wp-content/themes/sky-way/images/no-image.jpg"/>';
}
}
Thank you in advance