-
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.x' into reorder-twig-files
- Loading branch information
Showing
9 changed files
with
124 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
<?php | ||
|
||
/** | ||
* The template for displaying 404 pages (Not Found) | ||
* | ||
* Methods for TimberHelper can be found in the /functions sub-directory | ||
* | ||
* @package WordPress | ||
* @subpackage Timber | ||
* @since Timber 0.1 | ||
* The template for the 404 page | ||
*/ | ||
|
||
namespace App; | ||
|
||
use Timber\Timber; | ||
|
||
$context = Timber::context(); | ||
Timber::render('templates/404.twig', $context); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
<?php | ||
|
||
/** | ||
* The template for displaying Author Archive pages | ||
* | ||
* Methods for TimberHelper can be found in the /lib sub-directory | ||
* | ||
* @package WordPress | ||
* @subpackage Timber | ||
* @since Timber 0.1 | ||
*/ | ||
|
||
namespace App; | ||
|
||
use Timber\Timber; | ||
|
||
global $wp_query; | ||
|
||
$context = Timber::context(); | ||
$context['posts'] = Timber::get_posts(); | ||
if ( isset( $wp_query->query_vars['author'] ) ) { | ||
$author = Timber::get_user( $wp_query->query_vars['author'] ); | ||
$context['author'] = $author; | ||
$context['title'] = 'Author Archives: ' . $author->name(); | ||
$author = false; | ||
$title = false; | ||
|
||
if (isset($wp_query->query_vars['author'])) { | ||
$author = Timber::get_user($wp_query->query_vars['author']); | ||
$title = 'Author Archives: ' . $author->name(); | ||
} | ||
|
||
$context = Timber::context([ | ||
'title' => $title, | ||
'author' => $author, | ||
]); | ||
|
||
Timber::render( array( 'templates/author.twig', 'templates/archive.twig' ), $context ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
<?php | ||
|
||
/** | ||
* Timber starter-theme | ||
* https://github.com/timber/starter-theme | ||
* Functions and definitions | ||
* | ||
* @link https://developer.wordpress.org/themes/basics/theme-functions/ | ||
* @link https://github.com/timber/starter-theme | ||
*/ | ||
|
||
namespace App; | ||
|
||
use Timber\Timber; | ||
|
||
// Load Composer dependencies. | ||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
require_once __DIR__ . '/src/StarterSite.php'; | ||
|
||
Timber\Timber::init(); | ||
|
||
// Sets the directories (inside your theme) to find .twig files. | ||
Timber::$dirname = [ 'templates', 'views' ]; | ||
Timber::init(); | ||
|
||
new StarterSite(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
<?php | ||
|
||
/** | ||
* The main template file | ||
* | ||
* This is the most generic template file in a WordPress theme | ||
* and one of the two required files for a theme (the other being style.css). | ||
* It is used to display a page when nothing more specific matches a query. | ||
* E.g., it puts together the home page when no home.php file exists | ||
* E.g., it puts together the home page when no home.php file exists. | ||
* | ||
* Methods for TimberHelper can be found in the /lib sub-directory | ||
* | ||
* @package WordPress | ||
* @subpackage Timber | ||
* @since Timber 0.1 | ||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/ | ||
*/ | ||
|
||
$context = Timber::context(); | ||
$context['posts'] = Timber::get_posts(); | ||
$context['foo'] = 'bar'; | ||
$templates = array( 'templates/index.twig' ); | ||
if ( is_home() ) { | ||
use Timber\Timber; | ||
|
||
$templates = array('templates/index.twig'); | ||
|
||
if (is_home()) { | ||
array_unshift( $templates, 'templates/front-page.twig', 'templates/home.twig' ); | ||
} | ||
Timber::render( $templates, $context ); | ||
|
||
$context = Timber::context([ | ||
'foo' => 'bar', | ||
]); | ||
|
||
Timber::render($templates, $context); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
<?php | ||
|
||
/** | ||
* Search results page | ||
* | ||
* Methods for TimberHelper can be found in the /lib sub-directory | ||
* | ||
* @package WordPress | ||
* @subpackage Timber | ||
* @since Timber 0.1 | ||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/ | ||
*/ | ||
|
||
use Timber\Timber; | ||
|
||
$templates = array( 'templates/search.twig', 'templates/archive.twig', 'templates/index.twig' ); | ||
|
||
$context = Timber::context(); | ||
$context['title'] = 'Search results for ' . get_search_query(); | ||
$context['posts'] = Timber::get_posts(); | ||
$context = Timber::context([ | ||
'title' => 'Search results for ' . get_search_query(), | ||
]); | ||
|
||
Timber::render( $templates, $context ); | ||
Timber::render($templates, $context); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.