$category_name = (!empty(get_the_category($post)) ? get_the_category($post)[0]->name : '');