Bring the data forth

WordPress has several functions for getting data or sets of a data, like a post. I wanted to build a post format that nests the latest blog post inside of it.

It’s not an uncommon need – a little searching found plenty of people who had asked how to do it, often for menu links. I still hit a problem, though. One function, get_recent_posts, would display the content but either refused to show the featured image or showed the main post’s feature image, instead of the nested post.

OTOH, get_posts was happy to show the¬†correct thumbnail but refused to echo the content. I spent a few hours researching, experimenting, and playing but I will confess it turned out to be beyond my new php fu. I eventually solved it by calling most of the data with get_recent_posts and then calling the thumbnail with get_posts. It wasn’t elegant but it worked.

June 27, 2016

Frog Juggling Colorful Eggs

'Frog Juggling Colorful Eggs' modified from an old illustration. Source: Free Vintage Illustrations

The background textures used on this page are from Eos Development's Owl Thought and Cracked Texture Tile Series