Skip to content

Commit

Permalink
Merge pull request #17 from osomstudio/twig2
Browse files Browse the repository at this point in the history
Twig2
  • Loading branch information
tomzielinski authored Mar 15, 2024
2 parents ebdd6e7 + a7fc644 commit ab7145a
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"oscarotero/env": "^2.1",
"roots/bedrock-autoloader": "^1.0",
"roots/bedrock-disallow-indexing": "^2.0",
"roots/wordpress": "6.2",
"roots/wordpress": "6.4.3",
"roots/wp-config": "1.0.0",
"roots/wp-password-bcrypt": "1.0.0",
"soberwp/models": "dev-master",
Expand Down
2 changes: 1 addition & 1 deletion web/app/themes/juniper-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_post();

Timber::render( $templates, $context );
2 changes: 1 addition & 1 deletion web/app/themes/juniper-theme/author.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
global $wp_query;

$context = Timber::context();
$context['posts'] = new Timber\PostQuery();
$context['posts'] = Timber::get_post();
if ( isset( $wp_query->query_vars['author'] ) ) {
$author = new Timber\User( $wp_query->query_vars['author'] );
$context['author'] = $author;
Expand Down
1 change: 0 additions & 1 deletion web/app/themes/juniper-theme/class-startersite.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public function __construct() {
* @param string $context context['this'] Being the Twig's {{ this }}.
*/
public function add_to_context( $context ) {
$context['menu'] = new Timber\Menu();
$context['site'] = $this;
return $context;
}
Expand Down
9 changes: 7 additions & 2 deletions web/app/themes/juniper-theme/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "junipertheme/junipertheme",
"type": "library",
"require": {
"timber/timber": "^1.19",
"timber/timber": "^2.0",
"palmiak/timber-acf-wp-blocks": "^1.15"
},
"autoload": {
Expand All @@ -15,5 +15,10 @@
"name": "bartnovak",
"email": "b.nowak@osomstudio.com"
}
]
],
"config": {
"allow-plugins": {
"composer/installers": true
}
}
}
2 changes: 1 addition & 1 deletion web/app/themes/juniper-theme/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

if ( file_exists( $composer_autoload ) ) {
require_once $composer_autoload;
$timber = new Timber\Timber();
Timber\Timber::init();
}

require_once 'inc/include.php';
Expand Down
2 changes: 1 addition & 1 deletion web/app/themes/juniper-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_post();
$context['foo'] = 'bar';
$templates = array( 'index.twig' );
if ( is_home() ) {
Expand Down
2 changes: 1 addition & 1 deletion web/app/themes/juniper-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_post();

Timber::render( $templates, $context );

0 comments on commit ab7145a

Please sign in to comment.