Timber - Version 0.16.2

Version Description

  • Added has_term to TimberPost
  • Extra checks to make sure redirected links don't get 404 body class
  • Misc bugs
Download this release

Release Info

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

Code changes from version 0.16.1 to 0.16.2

functions/timber-helper.php CHANGED
@@ -329,8 +329,14 @@ class TimberHelper {
329
  if (is_array($array)) {
330
  $i = 0;
331
  foreach ($array as $arr) {
332
- if ($arr->$key == $value || $arr[$key] == $value) {
333
- return $i;
 
 
 
 
 
 
334
  }
335
  $i++;
336
  }
329
  if (is_array($array)) {
330
  $i = 0;
331
  foreach ($array as $arr) {
332
+ if (is_array($arr)){
333
+ if ($arr[$key] == $value){
334
+ return $i;
335
+ }
336
+ } else {
337
+ if ($arr->$key == $value) {
338
+ return $i;
339
+ }
340
  }
341
  $i++;
342
  }
functions/timber-post.php CHANGED
@@ -391,6 +391,21 @@ class TimberPost extends TimberCore {
391
  return $ret;
392
  }
393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  function get_image($field) {
395
  return new $this->ImageClass($this->$field);
396
  }
@@ -519,6 +534,10 @@ class TimberPost extends TimberCore {
519
  return $this->get_next();
520
  }
521
 
 
 
 
 
522
  public function path() {
523
  return $this->get_path();
524
  }
391
  return $ret;
392
  }
393
 
394
+ function has_term($term_name_or_id, $taxonomy = 'all'){
395
+ if ($taxonomy == 'all' || $taxonomy == 'any'){
396
+ $taxes = get_object_taxonomies($this->post_type, 'names');
397
+ $ret = false;
398
+ foreach($taxes as $tax){
399
+ if (has_term($term_name_or_id, $tax, $this->ID)){
400
+ $ret = true;
401
+ break;
402
+ }
403
+ }
404
+ return $ret;
405
+ }
406
+ return has_term($term_name_or_id, $taxonomy, $this->ID);
407
+ }
408
+
409
  function get_image($field) {
410
  return new $this->ImageClass($this->$field);
411
  }
534
  return $this->get_next();
535
  }
536
 
537
+ public function parent(){
538
+ return $this->get_parent();
539
+ }
540
+
541
  public function path() {
542
  return $this->get_path();
543
  }
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: jarednova
3
  Tags: template engine, templates, twig
4
  Requires at least: 3.5
5
- Stable tag: 0.16.1
6
  Tested up to: 3.7.1
7
  PHP version: 5.3.0 or greater
8
  License: GPLv2 or later
@@ -41,6 +41,11 @@ Timber is great for any WordPress developer who cares about writing good, mainta
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
44
  = 0.16.1 =
45
  * Bug fix on ugly permalinks for pagination
46
  * Fixed issue where posts retrieved via an array of IDs was truncated at the default post count
2
  Contributors: jarednova
3
  Tags: template engine, templates, twig
4
  Requires at least: 3.5
5
+ Stable tag: 0.16.2
6
  Tested up to: 3.7.1
7
  PHP version: 5.3.0 or greater
8
  License: GPLv2 or later
41
 
42
  == Changelog ==
43
 
44
+ = 0.16.2 =
45
+ * Added has_term to TimberPost
46
+ * Extra checks to make sure redirected links don't get 404 body class
47
+ * Misc bugs
48
+
49
  = 0.16.1 =
50
  * Bug fix on ugly permalinks for pagination
51
  * Fixed issue where posts retrieved via an array of IDs was truncated at the default post count
timber.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Timber
4
  Plugin URI: http://timber.upstatement.com
5
  Description: The WordPress Timber Library allows you to write themes using the power Twig templates
6
  Author: Jared Novack + Upstatement
7
- Version: 0.16.1
8
  Author URI: http://upstatement.com/
9
  */
10
 
@@ -473,6 +473,10 @@ class Timber {
473
  $query->is_404 = false;
474
  }
475
  });
 
 
 
 
476
  }
477
  }
478
 
4
  Plugin URI: http://timber.upstatement.com
5
  Description: The WordPress Timber Library allows you to write themes using the power Twig templates
6
  Author: Jared Novack + Upstatement
7
+ Version: 0.16.2
8
  Author URI: http://upstatement.com/
9
  */
10
 
473
  $query->is_404 = false;
474
  }
475
  });
476
+ add_action('template_redirect', function(){
477
+ global $wp_query;
478
+ $wp_query->is_404 = false;
479
+ });
480
  }
481
  }
482