in your code, you are checking the category of a post which is quite random outside of the loop and when the posts have more than one category;
the category ID of a category archive page is usually:
$cat_ID = get_query_var('cat');
in your code, you are checking the category of a post which is quite random outside of the loop and when the posts have more than one category;
the category ID of a category archive page is usually:
$cat_ID = get_query_var('cat');