Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Enable Post::convert() to convert also single WP_Posts #1439
When a developer tries to use get_field on a relationship or repeater field, Timber returns an array with instances of TimberPost. However, that didn't happen for Post Object fields, and a WP_Post was returned instead.
In the convert function used by get_field, a if condition was added to check if the argument given is an instance of WP_Post (and not an array of course), and returns an instance of TimberPost.
None that I'm aware of.
Ability to use get_field() on a Post Object field and get a TimberPost
The last line would fail because
@@ Coverage Diff @@ ## master #1439 +/- ## ============================================ + Coverage 93.94% 93.94% +<.01% - Complexity 1410 1411 +1 ============================================ Files 46 46 Lines 3402 3404 +2 ============================================ + Hits 3196 3198 +2 Misses 206 206
1 similar comment