Major refactor of JSONify Posts

In relation to Footprints ticket #397176

 - Split caching into separate functions
 - Re-wrote logic to fetch published posts only
 - Kept logic to update caching file on-the-fly