added code for get category to each post