so the CMB2 part is just a file list to upload images to a page. Then i installed a plugin to add categories to the media attachments. I believe its just using the categories taxonomy. I tried to just add categories my self but my boss wanted to have check boxes in the popup modal for the media so this plugin handled that.
Ok so I have the images upload and some categories check in the pop up modal. I have got the images on to the page using CMB2 example page code for file_list. Now i need to some how get the cat_names that are associated with each image, which could be more then one cat_name, and then add them to a div class. I am doing this so that I can use isotope to filter the divs. Does that make sense. and now i am using the $attachment id to get the images categories with this
$category = get_the_category($attachmentID);
then show the cat_names like so
but the problem now is that it jsut shows the first one i think because of the 0 but some have more then one do you now how to get all of the cat_names from the array do i need to do a loop of some sort?