diff --git a/composer.json b/composer.json index 7d5994fc3..11a67b1f2 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "timber/timber": "dev-2.x-term-factories" + "timber/timber": "2.x-dev" }, "require-dev": { "phpunit/phpunit": "7.*", diff --git a/theme/archive.php b/theme/archive.php index 148512ab9..0bba43c27 100644 --- a/theme/archive.php +++ b/theme/archive.php @@ -35,6 +35,6 @@ array_unshift( $templates, 'archive-' . get_post_type() . '.twig' ); } -$context['posts'] = new Timber\PostQuery(); +$context['posts'] = Timber::get_posts(); Timber::render( $templates, $context ); diff --git a/theme/author.php b/theme/author.php index 456f25661..22935423a 100644 --- a/theme/author.php +++ b/theme/author.php @@ -12,9 +12,9 @@ global $wp_query; $context = Timber::context(); -$context['posts'] = new Timber\PostQuery(); +$context['posts'] = Timber::get_posts(); if ( isset( $wp_query->query_vars['author'] ) ) { - $author = new Timber\User( $wp_query->query_vars['author'] ); + $author = Timber::get_user( $wp_query->query_vars['author'] ); $context['author'] = $author; $context['title'] = 'Author Archives: ' . $author->name(); } diff --git a/theme/functions.php b/theme/functions.php index 47d6e4a56..881c97962 100644 --- a/theme/functions.php +++ b/theme/functions.php @@ -16,7 +16,7 @@ $composer_autoload = dirname( __DIR__ ) . '/vendor/autoload.php'; if ( file_exists( $composer_autoload ) ) { require_once $composer_autoload; - $timber = new Timber\Timber(); + Timber\Timber::init(); } /** @@ -84,7 +84,7 @@ public function add_to_context( $context ) { $context['foo'] = 'bar'; $context['stuff'] = 'I am a value set in your functions.php file'; $context['notes'] = 'These values are available everytime you call Timber::context();'; - $context['menu'] = new Timber\Menu(); + $context['menu'] = Timber::get_menu(); $context['site'] = $this; return $context; } diff --git a/theme/index.php b/theme/index.php index 804e5556a..30dd82f4d 100644 --- a/theme/index.php +++ b/theme/index.php @@ -14,7 +14,7 @@ */ $context = Timber::context(); -$context['posts'] = new Timber\PostQuery(); +$context['posts'] = Timber::get_posts(); $context['foo'] = 'bar'; $templates = array( 'index.twig' ); if ( is_home() ) { diff --git a/theme/page.php b/theme/page.php index 2918bd3ae..256fb9d11 100644 --- a/theme/page.php +++ b/theme/page.php @@ -23,6 +23,6 @@ $context = Timber::context(); -$timber_post = new Timber\Post(); +$timber_post = Timber::get_post(); $context['post'] = $timber_post; Timber::render( array( 'page-' . $timber_post->post_name . '.twig', 'page.twig' ), $context ); diff --git a/theme/search.php b/theme/search.php index 600a6abbb..069b3aae7 100644 --- a/theme/search.php +++ b/theme/search.php @@ -13,6 +13,6 @@ $context = Timber::context(); $context['title'] = 'Search results for ' . get_search_query(); -$context['posts'] = new Timber\PostQuery(); +$context['posts'] = Timber::get_posts(); Timber::render( $templates, $context ); diff --git a/theme/single.php b/theme/single.php index 95d1d4774..e47be9045 100644 --- a/theme/single.php +++ b/theme/single.php @@ -10,7 +10,7 @@ */ $context = Timber::context(); -$timber_post = Timber::query_post(); +$timber_post = Timber::get_post(); $context['post'] = $timber_post; if ( post_password_required( $timber_post->ID ) ) {