Skip to content

Commit

Permalink
Merge pull request #131 from naderabbara/2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
gchtr authored Oct 12, 2022
2 parents 89fb8b9 + f62e96c commit b1946c5
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
"require": {
"timber/timber": "dev-2.x-term-factories"
"timber/timber": "2.x-dev"
},
"require-dev": {
"phpunit/phpunit": "7.*",
Expand Down
2 changes: 1 addition & 1 deletion theme/archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
4 changes: 2 additions & 2 deletions theme/author.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions theme/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion theme/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) {
Expand Down
2 changes: 1 addition & 1 deletion theme/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
2 changes: 1 addition & 1 deletion theme/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
2 changes: 1 addition & 1 deletion theme/single.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand Down

0 comments on commit b1946c5

Please sign in to comment.