Timber - Version 1.9.3

Version Description

Changes for Theme Developers - Fixed Timber::get_posts so that its default query parameters mirror WordPress's get_posts #1812 (thanks @bartvanraaij)

Download this release

Release Info

Developer jarednova
Plugin Icon 128x128 Timber
Version 1.9.3
Comparing to
See all releases

Code changes from version 1.9.2 to 1.9.3

lib/Comment.php CHANGED
@@ -7,10 +7,10 @@ use Timber\Core;
7
  use Timber\CoreInterface;
8
 
9
  /**
10
- * The TimberComment class is used to view the output of comments. 99% of the time this will be in the context of the comments on a post. However you can also fetch a comment directly using its comment ID.
11
  * @example
12
  * ```php
13
- * $comment = new TimberComment($comment_id);
14
  * $context['comment_of_the_day'] = $comment;
15
  * Timber::render('index.twig', $context);
16
  * ```
7
  use Timber\CoreInterface;
8
 
9
  /**
10
+ * The Timber\Comment class is used to view the output of comments. 99% of the time this will be in the context of the comments on a post. However you can also fetch a comment directly using its comment ID.
11
  * @example
12
  * ```php
13
+ * $comment = new Timber\Comment($comment_id);
14
  * $context['comment_of_the_day'] = $comment;
15
  * Timber::render('index.twig', $context);
16
  * ```
lib/Core.php CHANGED
@@ -50,7 +50,7 @@ abstract class Core {
50
  * @example
51
  * ```php
52
  * $data = array('airplane' => '757-200', 'flight' => '5316');
53
- * $post = new TimberPost()
54
  * $post->import(data);
55
  * echo $post->airplane; //757-200
56
  * ```
50
  * @example
51
  * ```php
52
  * $data = array('airplane' => '757-200', 'flight' => '5316');
53
+ * $post = new Timber\Post()
54
  * $post->import(data);
55
  * echo $post->airplane; //757-200
56
  * ```
lib/Helper.php CHANGED
@@ -15,7 +15,7 @@ class Helper {
15
  * @api
16
  * @example
17
  * ```php
18
- * $context = Timber::get_context();
19
  * $context['favorites'] = Timber\Helper::transient('user-' .$uid. '-favorites', function() use ($uid) {
20
  * //some expensive query here that's doing something you want to store to a transient
21
  * return $favorites;
@@ -145,8 +145,8 @@ class Helper {
145
  * echo '<form action="form.php"><input type="text" /><input type="submit /></form>';
146
  * }
147
  *
148
- * $context = Timber::get_context();
149
- * $context['post'] = new TimberPost();
150
  * $context['my_form'] = TimberHelper::ob_function('the_form');
151
  * Timber::render('single-form.twig', $context);
152
  * ```
15
  * @api
16
  * @example
17
  * ```php
18
+ * $context = Timber::context();
19
  * $context['favorites'] = Timber\Helper::transient('user-' .$uid. '-favorites', function() use ($uid) {
20
  * //some expensive query here that's doing something you want to store to a transient
21
  * return $favorites;
145
  * echo '<form action="form.php"><input type="text" /><input type="submit /></form>';
146
  * }
147
  *
148
+ * $context = Timber::context();
149
+ * $context['post'] = new Timber\Post();
150
  * $context['my_form'] = TimberHelper::ob_function('the_form');
151
  * Timber::render('single-form.twig', $context);
152
  * ```
lib/Image.php CHANGED
@@ -9,16 +9,16 @@ use Timber\URLHelper;
9
 
10
 
11
  /**
12
- * If TimberPost is the class you're going to spend the most time, TimberImage is the class you're going to have the most fun with.
13
  * @example
14
  * ```php
15
- * $context = Timber::get_context();
16
- * $post = new TimberPost();
17
  * $context['post'] = $post;
18
  *
19
  * // lets say you have an alternate large 'cover image' for your post stored in a custom field which returns an image ID
20
  * $cover_image_id = $post->cover_image;
21
- * $context['cover_image'] = new TimberImage($cover_image_id);
22
  * Timber::render('single.twig', $context);
23
  * ```
24
  *
@@ -85,14 +85,14 @@ class Image extends Post implements CoreInterface {
85
  protected $_wp_attached_file;
86
 
87
  /**
88
- * Creates a new TimberImage object
89
  * @example
90
  * ```php
91
  * // You can pass it an ID number
92
- * $myImage = new TimberImage(552);
93
  *
94
  * //Or send it a URL to an image
95
- * $myImage = new TimberImage('http://google.com/logo.jpg');
96
  * ```
97
  * @param bool|int|string $iid
98
  */
9
 
10
 
11
  /**
12
+ * If TimberPost is the class you're going to spend the most time, Timber\Image is the class you're going to have the most fun with.
13
  * @example
14
  * ```php
15
+ * $context = Timber::context();
16
+ * $post = new Timber\Post();
17
  * $context['post'] = $post;
18
  *
19
  * // lets say you have an alternate large 'cover image' for your post stored in a custom field which returns an image ID
20
  * $cover_image_id = $post->cover_image;
21
+ * $context['cover_image'] = new Timber\Image($cover_image_id);
22
  * Timber::render('single.twig', $context);
23
  * ```
24
  *
85
  protected $_wp_attached_file;
86
 
87
  /**
88
+ * Creates a new Timber\Image object
89
  * @example
90
  * ```php
91
  * // You can pass it an ID number
92
+ * $myImage = new Timber\Image(552);
93
  *
94
  * //Or send it a URL to an image
95
+ * $myImage = new Timber\Image('http://google.com/logo.jpg');
96
  * ```
97
  * @param bool|int|string $iid
98
  */
lib/Post.php CHANGED
@@ -20,7 +20,7 @@ use WP_Post;
20
  * @example
21
  * ```php
22
  * // single.php, see connected twig example
23
- * $context = Timber::get_context();
24
  * $context['post'] = new Timber\Post(); // It's a new Timber\Post object, but an existing post from WordPress.
25
  * Timber::render('single.twig', $context);
26
  * ?>
@@ -993,7 +993,7 @@ class Post extends Core implements CoreInterface {
993
  /**
994
  * Get the categoires on a particular post
995
  * @api
996
- * @return array of TimberTerms
997
  */
998
  public function categories() {
999
  return $this->terms('category');
@@ -1003,7 +1003,7 @@ class Post extends Core implements CoreInterface {
1003
  * Returns a category attached to a post
1004
  * @api
1005
  * If mulitpuile categories are set, it will return just the first one
1006
- * @return TimberTerm|null
1007
  */
1008
  public function category() {
1009
  return $this->get_category();
@@ -1049,13 +1049,13 @@ class Post extends Core implements CoreInterface {
1049
  }
1050
 
1051
  /**
1052
- * Gets the comments on a Timber\Post and returns them as an array of [TimberComments](#TimberComment) (or whatever comment class you set).
1053
  * @api
1054
  * @param int $count Set the number of comments you want to get. `0` is analogous to "all"
1055
  * @param string $order use ordering set in WordPress admin, or a different scheme
1056
  * @param string $type For when other plugins use the comments table for their own special purposes, might be set to 'liveblog' or other depending on what's stored in yr comments table
1057
  * @param string $status Could be 'pending', etc.
1058
- * @param string $CommentClass What class to use when returning Comment objects. As you become a Timber pro, you might find yourself extending TimberComment for your site or app (obviously, totally optional)
1059
  * @example
1060
  * ```twig
1061
  * {# single.twig #}
@@ -1592,7 +1592,7 @@ class Post extends Core implements CoreInterface {
1592
  * @deprecated since 1.0
1593
  * @codeCoverageIgnore
1594
  * @see Timber\Post::categories
1595
- * @return array of TimberTerms
1596
  */
1597
  public function get_categories() {
1598
  return $this->terms('category');
@@ -1614,7 +1614,7 @@ class Post extends Core implements CoreInterface {
1614
 
1615
  /**
1616
  * @param string $field
1617
- * @return TimberImage
1618
  */
1619
  public function get_image( $field ) {
1620
  return new $this->ImageClass($this->$field);
20
  * @example
21
  * ```php
22
  * // single.php, see connected twig example
23
+ * $context = Timber::context();
24
  * $context['post'] = new Timber\Post(); // It's a new Timber\Post object, but an existing post from WordPress.
25
  * Timber::render('single.twig', $context);
26
  * ?>
993
  /**
994
  * Get the categoires on a particular post
995
  * @api
996
+ * @return array of Timber\Terms
997
  */
998
  public function categories() {
999
  return $this->terms('category');
1003
  * Returns a category attached to a post
1004
  * @api
1005
  * If mulitpuile categories are set, it will return just the first one
1006
+ * @return Timber\Term|null
1007
  */
1008
  public function category() {
1009
  return $this->get_category();
1049
  }
1050
 
1051
  /**
1052
+ * Gets the comments on a Timber\Post and returns them as an array of [Timber\Comment](#TimberComment) (or whatever comment class you set).
1053
  * @api
1054
  * @param int $count Set the number of comments you want to get. `0` is analogous to "all"
1055
  * @param string $order use ordering set in WordPress admin, or a different scheme
1056
  * @param string $type For when other plugins use the comments table for their own special purposes, might be set to 'liveblog' or other depending on what's stored in yr comments table
1057
  * @param string $status Could be 'pending', etc.
1058
+ * @param string $CommentClass What class to use when returning Comment objects. As you become a Timber pro, you might find yourself extending Timber\Comment for your site or app (obviously, totally optional)
1059
  * @example
1060
  * ```twig
1061
  * {# single.twig #}
1592
  * @deprecated since 1.0
1593
  * @codeCoverageIgnore
1594
  * @see Timber\Post::categories
1595
+ * @return array of Timber\Terms
1596
  */
1597
  public function get_categories() {
1598
  return $this->terms('category');
1614
 
1615
  /**
1616
  * @param string $field
1617
+ * @return Timber\Image
1618
  */
1619
  public function get_image( $field ) {
1620
  return new $this->ImageClass($this->$field);
lib/PostGetter.php CHANGED
@@ -52,6 +52,7 @@ class PostGetter {
52
  }
53
 
54
  public static function get_posts( $query = false, $PostClass = '\Timber\Post', $return_collection = false ) {
 
55
  $posts = self::query_posts($query, $PostClass);
56
  return apply_filters('timber_post_getter_get_posts', $posts->get_posts($return_collection));
57
  }
@@ -63,6 +64,27 @@ class PostGetter {
63
  }
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  /**
67
  * @param mixed $query
68
  * @param string|array $PostClass
@@ -138,7 +160,7 @@ class PostGetter {
138
  Helper::error_log('Unexpeted value for PostClass: '.print_r($post_class, true));
139
  }
140
 
141
- if ( $post_class_use === '\Timber\Post' || $post_class_use === 'Timber\Post') {
142
  return $post_class_use;
143
  }
144
 
52
  }
53
 
54
  public static function get_posts( $query = false, $PostClass = '\Timber\Post', $return_collection = false ) {
55
+ add_filter('pre_get_posts', array('Timber\PostGetter', 'set_query_defaults'));
56
  $posts = self::query_posts($query, $PostClass);
57
  return apply_filters('timber_post_getter_get_posts', $posts->get_posts($return_collection));
58
  }
64
  }
65
  }
66
 
67
+ /**
68
+ * Sets some default values for those parameters for the query when not set. WordPress's get_posts sets a few of
69
+ * these parameters true by default (compared to WP_Query), we should do the same.
70
+ * @internal
71
+ * @param \WP_Query $query
72
+ * @return \WP_Query
73
+ */
74
+ public static function set_query_defaults( $query ) {
75
+ if ( isset($query->query) && !isset($query->query['ignore_sticky_posts']) ) {
76
+ $query->set('ignore_sticky_posts', true);
77
+ }
78
+ if ( isset($query->query) && !isset($query->query['supress_filters']) ) {
79
+ $query->set('supress_filters', true);
80
+ }
81
+ if ( isset($query->query) && !isset($query->query['no_found_rows']) ) {
82
+ $query->set('no_found_rows', true);
83
+ }
84
+ remove_filter('pre_get_posts', array('Timber\PostGetter', 'set_query_defaults'));
85
+ return $query;
86
+ }
87
+
88
  /**
89
  * @param mixed $query
90
  * @param string|array $PostClass
160
  Helper::error_log('Unexpeted value for PostClass: '.print_r($post_class, true));
161
  }
162
 
163
+ if ( $post_class_use === '\Timber\Post' || $post_class_use === 'Timber\Post' ) {
164
  return $post_class_use;
165
  }
166
 
lib/QueryIterator.php CHANGED
@@ -23,6 +23,7 @@ class QueryIterator implements \Iterator, \Countable {
23
  public function __construct( $query = false, $posts_class = 'Timber\Post' ) {
24
  add_action('pre_get_posts', array($this, 'fix_number_posts_wp_quirk'));
25
  add_action('pre_get_posts', array($this, 'fix_cat_wp_quirk'));
 
26
  if ( $posts_class ) {
27
  $this->_posts_class = $posts_class;
28
  }
23
  public function __construct( $query = false, $posts_class = 'Timber\Post' ) {
24
  add_action('pre_get_posts', array($this, 'fix_number_posts_wp_quirk'));
25
  add_action('pre_get_posts', array($this, 'fix_cat_wp_quirk'));
26
+
27
  if ( $posts_class ) {
28
  $this->_posts_class = $posts_class;
29
  }
lib/Site.php CHANGED
@@ -9,12 +9,12 @@ use Timber\Theme;
9
  use Timber\Helper;
10
 
11
  /**
12
- * TimberSite gives you access to information you need about your site. In Multisite setups, you can get info on other sites in your network.
13
  * @example
14
  * ```php
15
- * $context = Timber::get_context();
16
  * $other_site_id = 2;
17
- * $context['other_site'] = new TimberSite($other_site_id);
18
  * Timber::render('index.twig', $context);
19
  * ```
20
  * ```twig
@@ -95,14 +95,14 @@ class Site extends Core implements CoreInterface {
95
  public $atom;
96
 
97
  /**
98
- * Constructs a TimberSite object
99
  * @example
100
  * ```php
101
  * //multisite setup
102
- * $site = new TimberSite(1);
103
- * $site_two = new TimberSite("My Cool Site");
104
  * //non-multisite
105
- * $site = new TimberSite();
106
  * ```
107
  * @param string|int $site_name_or_id
108
  */
@@ -283,7 +283,7 @@ class Site extends Core implements CoreInterface {
283
 
284
  /**
285
  * @deprecated 1.0.4
286
- * @see TimberSite::link
287
  * @return string
288
  */
289
  public function url() {
9
  use Timber\Helper;
10
 
11
  /**
12
+ * Timber\Site gives you access to information you need about your site. In Multisite setups, you can get info on other sites in your network.
13
  * @example
14
  * ```php
15
+ * $context = Timber::context();
16
  * $other_site_id = 2;
17
+ * $context['other_site'] = new Timber\Site($other_site_id);
18
  * Timber::render('index.twig', $context);
19
  * ```
20
  * ```twig
95
  public $atom;
96
 
97
  /**
98
+ * Constructs a Timber\Site object
99
  * @example
100
  * ```php
101
  * //multisite setup
102
+ * $site = new Timber\Site(1);
103
+ * $site_two = new Timber\Site("My Cool Site");
104
  * //non-multisite
105
+ * $site = new Timber\Site();
106
  * ```
107
  * @param string|int $site_name_or_id
108
  */
283
 
284
  /**
285
  * @deprecated 1.0.4
286
+ * @see Timber\Site::link
287
  * @return string
288
  */
289
  public function url() {
lib/Term.php CHANGED
@@ -15,13 +15,13 @@ use Timber\URLHelper;
15
  * @example
16
  * ```php
17
  * //Get a term by its ID
18
- * $context['term'] = new TimberTerm(6);
19
  * //Get a term when on a term archive page
20
- * $context['term_page'] = new TimberTerm();
21
  * //Get a term with a slug
22
- * $context['team'] = new TimberTerm('patriots');
23
  * //Get a team with a slug from a specific taxonomy
24
- * $context['st_louis'] = new TimberTerm('cardinals', 'baseball');
25
  * Timber::render('index.twig', $context);
26
  * ```
27
  * ```twig
@@ -224,7 +224,7 @@ class Term extends Core implements CoreInterface {
224
  $field_value = apply_filters('timber/term/meta/field', $field_value, $this->ID, $field_name, $this);
225
  }
226
  $this->$field_name = $field_value;
227
-
228
  }
229
  return $this->$field_name;
230
  }
@@ -377,7 +377,7 @@ class Term extends Core implements CoreInterface {
377
 
378
  /**
379
  * Retrieves and outputs meta information stored with a term. This will use
380
- * both data stored under (old) ACF hacks and new (WP 4.6+) where term meta
381
  * has its own table. If retrieving a special ACF field (repeater, etc.) you
382
  * can use the output immediately in Twig — no further processing is
383
  * required.
15
  * @example
16
  * ```php
17
  * //Get a term by its ID
18
+ * $context['term'] = new Timber\Term(6);
19
  * //Get a term when on a term archive page
20
+ * $context['term_page'] = new Timber\Term();
21
  * //Get a term with a slug
22
+ * $context['team'] = new Timber\Term('patriots');
23
  * //Get a team with a slug from a specific taxonomy
24
+ * $context['st_louis'] = new Timber\Term('cardinals', 'baseball');
25
  * Timber::render('index.twig', $context);
26
  * ```
27
  * ```twig
224
  $field_value = apply_filters('timber/term/meta/field', $field_value, $this->ID, $field_name, $this);
225
  }
226
  $this->$field_name = $field_value;
227
+
228
  }
229
  return $this->$field_name;
230
  }
377
 
378
  /**
379
  * Retrieves and outputs meta information stored with a term. This will use
380
+ * both data stored under (old) ACF hacks and new (WP 4.6+) where term meta
381
  * has its own table. If retrieving a special ACF field (repeater, etc.) you
382
  * can use the output immediately in Twig — no further processing is
383
  * required.
lib/Theme.php CHANGED
@@ -7,11 +7,11 @@ use Timber\Theme;
7
  use Timber\URLHelper;
8
 
9
  /**
10
- * Need to display info about your theme? Well you've come to the right place. By default info on the current theme comes for free with what's fetched by `Timber::get_context()` in which case you can access it your theme like so:
11
  * @example
12
  * ```php
13
  * <?php
14
- * $context = Timber::get_context();
15
  * Timber::render('index.twig', $context);
16
  * ?>
17
  * ```
@@ -62,7 +62,7 @@ class Theme extends Core {
62
  private $theme;
63
 
64
  /**
65
- * Constructs a new TimberTheme object. NOTE the TimberTheme object of the current theme comes in the default `Timber::get_context()` call. You can access this in your twig template via `{{site.theme}}.
66
  * @param string $slug
67
  * @example
68
  * ```php
@@ -116,7 +116,7 @@ class Theme extends Core {
116
  public function path() {
117
  // force = true to work with specifying the port
118
  // @see https://github.com/timber/timber/issues/1739
119
- return URLHelper::get_rel_url($this->link(), true);
120
  }
121
 
122
  /**
7
  use Timber\URLHelper;
8
 
9
  /**
10
+ * Need to display info about your theme? Well you've come to the right place. By default info on the current theme comes for free with what's fetched by `Timber::context()` in which case you can access it your theme like so:
11
  * @example
12
  * ```php
13
  * <?php
14
+ * $context = Timber::context();
15
  * Timber::render('index.twig', $context);
16
  * ?>
17
  * ```
62
  private $theme;
63
 
64
  /**
65
+ * Constructs a new TimberTheme object. NOTE the TimberTheme object of the current theme comes in the default `Timber::context()` call. You can access this in your twig template via `{{site.theme}}.
66
  * @param string $slug
67
  * @example
68
  * ```php
116
  public function path() {
117
  // force = true to work with specifying the port
118
  // @see https://github.com/timber/timber/issues/1739
119
+ return URLHelper::get_rel_url($this->link(), true);
120
  }
121
 
122
  /**
lib/Timber.php CHANGED
@@ -28,14 +28,14 @@ use Timber\Loader;
28
  * $posts = Timber::get_posts(array('post_type' => 'article', 'category_name' => 'sports')); // uses wp_query format.
29
  * $posts = Timber::get_posts(array(23,24,35,67), 'InkwellArticle');
30
  *
31
- * $context = Timber::get_context(); // returns wp favorites!
32
  * $context['posts'] = $posts;
33
  * Timber::render('index.twig', $context);
34
  * ```
35
  */
36
  class Timber {
37
 
38
- public static $version = '1.9.2';
39
  public static $locations;
40
  public static $dirname = 'views';
41
  public static $twig_cache = false;
@@ -387,7 +387,7 @@ class Timber {
387
  * @api
388
  * @example
389
  * ```php
390
- * $context = Timber::get_context();
391
  *
392
  * Timber::render( 'index.twig', $context );
393
  * ```
28
  * $posts = Timber::get_posts(array('post_type' => 'article', 'category_name' => 'sports')); // uses wp_query format.
29
  * $posts = Timber::get_posts(array(23,24,35,67), 'InkwellArticle');
30
  *
31
+ * $context = Timber::context(); // returns wp favorites!
32
  * $context['posts'] = $posts;
33
  * Timber::render('index.twig', $context);
34
  * ```
35
  */
36
  class Timber {
37
 
38
+ public static $version = '1.9.3';
39
  public static $locations;
40
  public static $dirname = 'views';
41
  public static $twig_cache = false;
387
  * @api
388
  * @example
389
  * ```php
390
+ * $context = Timber::context();
391
  *
392
  * Timber::render( 'index.twig', $context );
393
  * ```
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: jarednova, connorjburton, lggorman
3
  Tags: template engine, templates, twig
4
  Requires at least: 4.7.12
5
- Tested up to: 5.1
6
- Stable tag: 1.9.2
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -36,6 +36,11 @@ _Twig is the template language powering Timber; if you need a little background
36
  **Changes for Theme Developers**
37
  - Please add bullet points here with your PR. The heading for this section will get the correct version number once released.
38
 
 
 
 
 
 
39
  = 1.9.2 =
40
 
41
  **Changes for Theme Developers**
2
  Contributors: jarednova, connorjburton, lggorman
3
  Tags: template engine, templates, twig
4
  Requires at least: 4.7.12
5
+ Tested up to: 5.1.1
6
+ Stable tag: 1.9.3
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
36
  **Changes for Theme Developers**
37
  - Please add bullet points here with your PR. The heading for this section will get the correct version number once released.
38
 
39
+ = 1.9.3 =
40
+
41
+ **Changes for Theme Developers**
42
+ - Fixed `Timber::get_posts` so that its default query parameters mirror WordPress's `get_posts` #1812 (thanks @bartvanraaij)
43
+
44
  = 1.9.2 =
45
 
46
  **Changes for Theme Developers**
timber-starter-theme/404.php CHANGED
@@ -9,5 +9,5 @@
9
  * @since Timber 0.1
10
  */
11
 
12
- $context = Timber::get_context();
13
  Timber::render( '404.twig', $context );
9
  * @since Timber 0.1
10
  */
11
 
12
+ $context = Timber::context();
13
  Timber::render( '404.twig', $context );
timber-starter-theme/archive.php CHANGED
@@ -16,7 +16,7 @@
16
 
17
  $templates = array( 'archive.twig', 'index.twig' );
18
 
19
- $context = Timber::get_context();
20
 
21
  $context['title'] = 'Archive';
22
  if ( is_day() ) {
16
 
17
  $templates = array( 'archive.twig', 'index.twig' );
18
 
19
+ $context = Timber::context();
20
 
21
  $context['title'] = 'Archive';
22
  if ( is_day() ) {
timber-starter-theme/author.php CHANGED
@@ -11,7 +11,7 @@
11
 
12
  global $wp_query;
13
 
14
- $context = Timber::get_context();
15
  $context['posts'] = new Timber\PostQuery();
16
  if ( isset( $wp_query->query_vars['author'] ) ) {
17
  $author = new Timber\User( $wp_query->query_vars['author'] );
11
 
12
  global $wp_query;
13
 
14
+ $context = Timber::context();
15
  $context['posts'] = new Timber\PostQuery();
16
  if ( isset( $wp_query->query_vars['author'] ) ) {
17
  $author = new Timber\User( $wp_query->query_vars['author'] );
timber-starter-theme/functions.php CHANGED
@@ -62,7 +62,7 @@ class StarterSite extends Timber\Site {
62
  public function add_to_context( $context ) {
63
  $context['foo'] = 'bar';
64
  $context['stuff'] = 'I am a value set in your functions.php file';
65
- $context['notes'] = 'These values are available everytime you call Timber::get_context();';
66
  $context['menu'] = new Timber\Menu();
67
  $context['site'] = $this;
68
  return $context;
62
  public function add_to_context( $context ) {
63
  $context['foo'] = 'bar';
64
  $context['stuff'] = 'I am a value set in your functions.php file';
65
+ $context['notes'] = 'These values are available everytime you call Timber::context();';
66
  $context['menu'] = new Timber\Menu();
67
  $context['site'] = $this;
68
  return $context;
timber-starter-theme/header.php CHANGED
@@ -11,5 +11,5 @@
11
  * @since Timber 0.1
12
  */
13
 
14
- $GLOBALS['timberContext'] = Timber::get_context();
15
  ob_start();
11
  * @since Timber 0.1
12
  */
13
 
14
+ $GLOBALS['timberContext'] = Timber::context();
15
  ob_start();
timber-starter-theme/index.php CHANGED
@@ -13,7 +13,7 @@
13
  * @since Timber 0.1
14
  */
15
 
16
- $context = Timber::get_context();
17
  $context['posts'] = new Timber\PostQuery();
18
  $context['foo'] = 'bar';
19
  $templates = array( 'index.twig' );
13
  * @since Timber 0.1
14
  */
15
 
16
+ $context = Timber::context();
17
  $context['posts'] = new Timber\PostQuery();
18
  $context['foo'] = 'bar';
19
  $templates = array( 'index.twig' );
timber-starter-theme/page.php CHANGED
@@ -21,8 +21,8 @@
21
  * @since Timber 0.1
22
  */
23
 
24
- $context = Timber::get_context();
25
 
26
  $timber_post = new Timber\Post();
27
  $context['post'] = $timber_post;
28
- Timber::render( array( 'page-' . $timber_post->post_name . '.twig', 'page.twig' ), $context );
21
  * @since Timber 0.1
22
  */
23
 
24
+ $context = Timber::context();
25
 
26
  $timber_post = new Timber\Post();
27
  $context['post'] = $timber_post;
28
+ Timber::render( array( 'page-' . $timber_post->post_name . '.twig', 'page.twig' ), $context );
timber-starter-theme/search.php CHANGED
@@ -11,7 +11,7 @@
11
 
12
  $templates = array( 'search.twig', 'archive.twig', 'index.twig' );
13
 
14
- $context = Timber::get_context();
15
  $context['title'] = 'Search results for ' . get_search_query();
16
  $context['posts'] = new Timber\PostQuery();
17
 
11
 
12
  $templates = array( 'search.twig', 'archive.twig', 'index.twig' );
13
 
14
+ $context = Timber::context();
15
  $context['title'] = 'Search results for ' . get_search_query();
16
  $context['posts'] = new Timber\PostQuery();
17
 
timber-starter-theme/single.php CHANGED
@@ -9,7 +9,7 @@
9
  * @since Timber 0.1
10
  */
11
 
12
- $context = Timber::get_context();
13
  $timber_post = Timber::query_post();
14
  $context['post'] = $timber_post;
15
 
9
  * @since Timber 0.1
10
  */
11
 
12
+ $context = Timber::context();
13
  $timber_post = Timber::query_post();
14
  $context['post'] = $timber_post;
15
 
timber-starter-theme/tests/test-timber-starter-theme.php CHANGED
@@ -12,7 +12,7 @@
12
  }
13
 
14
  function testFunctionsPHP() {
15
- $context = Timber::get_context();
16
  $this->assertEquals('StarterSite', get_class($context['site']));
17
  $this->assertTrue(current_theme_supports('post-thumbnails'));
18
  $this->assertEquals('bar', $context['foo']);
12
  }
13
 
14
  function testFunctionsPHP() {
15
+ $context = Timber::context();
16
  $this->assertEquals('StarterSite', get_class($context['site']));
17
  $this->assertTrue(current_theme_supports('post-thumbnails'));
18
  $this->assertEquals('bar', $context['foo']);
timber.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Timber
4
  Description: The WordPress Timber Library allows you to write themes using the power of Twig templates.
5
  Plugin URI: http://timber.upstatement.com
6
  Author: Jared Novack + Upstatement
7
- Version: 1.9.2
8
  Author URI: http://upstatement.com/
9
  */
10
  // we look for Composer files first in the plugins dir.
4
  Description: The WordPress Timber Library allows you to write themes using the power of Twig templates.
5
  Plugin URI: http://timber.upstatement.com
6
  Author: Jared Novack + Upstatement
7
+ Version: 1.9.3
8
  Author URI: http://upstatement.com/
9
  */
10
  // we look for Composer files first in the plugins dir.
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit67a1de83cd78fdba34c58ae2f6651dfe::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit48a0e50ee74d15c846cc23afdacbfb84::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit67a1de83cd78fdba34c58ae2f6651dfe
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit67a1de83cd78fdba34c58ae2f6651dfe
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit67a1de83cd78fdba34c58ae2f6651dfe', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit67a1de83cd78fdba34c58ae2f6651dfe', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit48a0e50ee74d15c846cc23afdacbfb84
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit48a0e50ee74d15c846cc23afdacbfb84', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit48a0e50ee74d15c846cc23afdacbfb84', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {