Getting images from media library and get_the_date() not working
get_the_date depends on the global $post variable. It is a bit hard to tell that that is the case but if you look at the source for get_the_date you’ll see that it uses get_post and it assumes $post if no other parameters are given. Your code never sets that global $post variable except for when … Read more