Version Description
- Fixed issues with static post pages
- Fixed issues with front pages with static pages
Download this release
Release Info
Developer | jarednova |
Plugin | Timber |
Version | 0.21.3 |
Comparing to | |
See all releases |
Code changes from version 0.21.2 to 0.21.3
- lib/timber-post-getter.php +1 -1
- lib/timber-post.php +7 -1
- lib/timber-query-iterator.php +16 -1
- readme.txt +5 -1
- timber.php +1 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +4 -4
lib/timber-post-getter.php
CHANGED
@@ -33,7 +33,7 @@ class TimberPostGetter {
|
|
33 |
* @param string $PostClass
|
34 |
* @return array|bool|null
|
35 |
*/
|
36 |
-
static function query_posts($query = false, $PostClass = 'TimberPost' ){
|
37 |
if (self::is_post_class_or_class_map($query)) {
|
38 |
$PostClass = $query;
|
39 |
$query = false;
|
33 |
* @param string $PostClass
|
34 |
* @return array|bool|null
|
35 |
*/
|
36 |
+
static function query_posts($query = false, $PostClass = 'TimberPost' ) {
|
37 |
if (self::is_post_class_or_class_map($query)) {
|
38 |
$PostClass = $query;
|
39 |
$query = false;
|
lib/timber-post.php
CHANGED
@@ -52,7 +52,7 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
|
|
52 |
&& get_class($wp_query->queried_object) == 'WP_Post'
|
53 |
) {
|
54 |
$pid = $wp_query->queried_object_id;
|
55 |
-
} else if ($wp_query->is_home && isset($wp_query->queried_object_id) && $wp_query->queried_object_id ) {
|
56 |
//hack for static page as home page
|
57 |
$pid = $wp_query->queried_object_id;
|
58 |
} else if ($pid === null) {
|
@@ -64,6 +64,12 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
|
|
64 |
if ( $gtid ) {
|
65 |
$pid = get_the_ID();
|
66 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
if ($pid === null && ($pid_from_loop = TimberPostGetter::loop_to_id())) {
|
69 |
$pid = $pid_from_loop;
|
52 |
&& get_class($wp_query->queried_object) == 'WP_Post'
|
53 |
) {
|
54 |
$pid = $wp_query->queried_object_id;
|
55 |
+
} else if ($pid === null && $wp_query->is_home && isset($wp_query->queried_object_id) && $wp_query->queried_object_id ) {
|
56 |
//hack for static page as home page
|
57 |
$pid = $wp_query->queried_object_id;
|
58 |
} else if ($pid === null) {
|
64 |
if ( $gtid ) {
|
65 |
$pid = get_the_ID();
|
66 |
}
|
67 |
+
if ( !$pid ) {
|
68 |
+
global $wp_query;
|
69 |
+
if ( isset($wp_query->query['p']) ) {
|
70 |
+
$pid = $wp_query->query['p'];
|
71 |
+
}
|
72 |
+
}
|
73 |
}
|
74 |
if ($pid === null && ($pid_from_loop = TimberPostGetter::loop_to_id())) {
|
75 |
$pid = $pid_from_loop;
|
lib/timber-query-iterator.php
CHANGED
@@ -26,7 +26,8 @@ class TimberQueryIterator implements Iterator {
|
|
26 |
// If query is explicitly set to false, use the main loop
|
27 |
global $wp_query;
|
28 |
$the_query =& $wp_query;
|
29 |
-
|
|
|
30 |
} elseif ( TimberHelper::is_array_assoc( $query ) || ( is_string( $query ) && strstr( $query, '=' ) ) ) {
|
31 |
// We have a regularly formed WP query string or array to use
|
32 |
$the_query = new WP_Query( $query );
|
@@ -138,4 +139,18 @@ class TimberQueryIterator implements Iterator {
|
|
138 |
return $query;
|
139 |
}
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
26 |
// If query is explicitly set to false, use the main loop
|
27 |
global $wp_query;
|
28 |
$the_query =& $wp_query;
|
29 |
+
//if we're on a custom posts page?
|
30 |
+
$the_query = self::handle_maybe_custom_posts_page($the_query);
|
31 |
} elseif ( TimberHelper::is_array_assoc( $query ) || ( is_string( $query ) && strstr( $query, '=' ) ) ) {
|
32 |
// We have a regularly formed WP query string or array to use
|
33 |
$the_query = new WP_Query( $query );
|
139 |
return $query;
|
140 |
}
|
141 |
|
142 |
+
/**
|
143 |
+
* this will test for whether a custom page to display posts is active, and if so, set the query to the default
|
144 |
+
* @param WP_Query $query the original query recived from WordPress
|
145 |
+
* @return WP_Query
|
146 |
+
*/
|
147 |
+
static function handle_maybe_custom_posts_page( $query ) {
|
148 |
+
if ($custom_posts_page = get_option('page_for_posts')) {
|
149 |
+
if ( isset($query->query['p']) && $query->query['p'] == $custom_posts_page ) {
|
150 |
+
return new WP_Query(array('post_type' => 'post'));
|
151 |
+
}
|
152 |
+
}
|
153 |
+
return $query;
|
154 |
+
}
|
155 |
+
|
156 |
}
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: jarednova
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 3.7
|
5 |
-
Stable tag: 0.21.
|
6 |
Tested up to: 4.1
|
7 |
PHP version: 5.3.0 or greater
|
8 |
License: GPLv2 or later
|
@@ -41,6 +41,10 @@ Timber is great for any WordPress developer who cares about writing good, mainta
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
44 |
= 0.21.2 =
|
45 |
* Fixed GIF handling (thanks @josephbergdoll and @jarednova)
|
46 |
* Improved handling of diff't image sizes
|
2 |
Contributors: jarednova
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 3.7
|
5 |
+
Stable tag: 0.21.3
|
6 |
Tested up to: 4.1
|
7 |
PHP version: 5.3.0 or greater
|
8 |
License: GPLv2 or later
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
+
= 0.21.3 =
|
45 |
+
* Fixed issues with static post pages
|
46 |
+
* Fixed issues with front pages with static pages
|
47 |
+
|
48 |
= 0.21.2 =
|
49 |
* Fixed GIF handling (thanks @josephbergdoll and @jarednova)
|
50 |
* Improved handling of diff't image sizes
|
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.21.
|
8 |
Author URI: http://upstatement.com/
|
9 |
*/
|
10 |
|
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.21.3
|
8 |
Author URI: http://upstatement.com/
|
9 |
*/
|
10 |
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit0aac21df2a554d21b56a530bb2ccb977::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitba544e60fe73a624e4f8eb697a7b6443
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
@@ -44,7 +44,7 @@ class ComposerAutoloaderInitba544e60fe73a624e4f8eb697a7b6443
|
|
44 |
}
|
45 |
}
|
46 |
|
47 |
-
function
|
48 |
{
|
49 |
require $file;
|
50 |
}
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit0aac21df2a554d21b56a530bb2ccb977
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit0aac21df2a554d21b56a530bb2ccb977', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit0aac21df2a554d21b56a530bb2ccb977', 'loadClassLoader'));
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
44 |
}
|
45 |
}
|
46 |
|
47 |
+
function composerRequire0aac21df2a554d21b56a530bb2ccb977($file)
|
48 |
{
|
49 |
require $file;
|
50 |
}
|