timber / timber

Create WordPress themes with beautiful OOP code and the Twig Template Engine

Home Page:https://timber.github.io/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Documentation Error in 2.0 Upgrade Guide

KingWebsites opened this issue · comments

Expected Behavior

https://timber.github.io/docs/v2/upgrade-guides/2.0/#context

At bottom of the Context section of the 2.0 upgrade guide showing how to pass variables directly to context it should display the code as:

$context['posts'] = Timber::get_posts([
        'post_type' => 'book',
        'posts_per_page' => -1,
        'post_status' => 'publish',
]);

Actual behavior

It actually displays the code with the query wrapped in a "query" object. I couldn't get this way to work, but the above worked fine.

$context['posts'] = Timber::get_posts([
    'query' => [
        'post_type' => 'book',
        'posts_per_page' => -1,
        'post_status' => 'publish',
    ],
]);

Steps to reproduce behavior

No response

Notes

Correct syntax shown in 2.0 docs here: https://timber.github.io/docs/v2/guides/posts/#querying-posts

What version of Timber are you using?

2.0

What version of WordPress are you using?

No response

What version of PHP are you using?

No response

How did you install Timber?

Installed or updated Timber through Composer

Thanks @KingWebsites for your report! Really helps to keep the docs consistent!. Pr is now available.