Added new function to create recent posts API