Loop through an array and take a special item from each array object and put it into a new array
<?php $categories = get_the_category(); //Returning an array with all the categories for the current post //if we have any categories then well copy into an array if ($categories) { $class_names = array(); foreach ($categories as $category) { $class_names[] = 'cat-' . $category->slug; } } ?>