Version Description
- Fix preview not rendering correct template and other post meta.
Download this release
Release Info
Developer | husobj |
Plugin | WP Subtitle |
Version | 2.9.1 |
Comparing to | |
See all releases |
Code changes from version 2.9 to 2.9.1
- CHANGELOG.md +7 -1
- README.md +3 -0
- includes/subtitle.php +14 -0
- readme.txt +8 -2
- wp-subtitle.php +2 -26
CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4 |
|
5 |
## [Unreleased]
|
6 |
|
|
|
|
|
|
|
|
|
|
|
7 |
## [2.9] - 2017-05-03
|
8 |
|
9 |
### Added
|
@@ -132,7 +137,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
132 |
### Added
|
133 |
- First version.
|
134 |
|
135 |
-
[Unreleased]: https://github.com/benhuson/wp-subtitle/compare/2.9...HEAD
|
|
|
136 |
[2.9]: https://github.com/benhuson/wp-subtitle/compare/2.8.1...2.9
|
137 |
[2.8.1]: https://github.com/benhuson/wp-subtitle/compare/2.8...2.8.1
|
138 |
[2.8]: https://github.com/benhuson/wp-subtitle/compare/2.7.1...2.8
|
4 |
|
5 |
## [Unreleased]
|
6 |
|
7 |
+
## [2.9.1] - 2017-06-01
|
8 |
+
|
9 |
+
### Fixed
|
10 |
+
- Fix preview not rendering correct template and other post meta.
|
11 |
+
|
12 |
## [2.9] - 2017-05-03
|
13 |
|
14 |
### Added
|
137 |
### Added
|
138 |
- First version.
|
139 |
|
140 |
+
[Unreleased]: https://github.com/benhuson/wp-subtitle/compare/2.9.1...HEAD
|
141 |
+
[2.9.1]: https://github.com/benhuson/wp-subtitle/compare/2.9...2.9.1
|
142 |
[2.9]: https://github.com/benhuson/wp-subtitle/compare/2.8.1...2.9
|
143 |
[2.8.1]: https://github.com/benhuson/wp-subtitle/compare/2.8...2.8.1
|
144 |
[2.8]: https://github.com/benhuson/wp-subtitle/compare/2.7.1...2.8
|
README.md
CHANGED
@@ -88,6 +88,9 @@ The plugin is [hosted on GitHub](https://github.com/benhuson/wp-subtitle) and pu
|
|
88 |
Upgrade Notice
|
89 |
--------------
|
90 |
|
|
|
|
|
|
|
91 |
### 2.9
|
92 |
Add support for revisions and fix special character encoding.
|
93 |
|
88 |
Upgrade Notice
|
89 |
--------------
|
90 |
|
91 |
+
### 2.9.1
|
92 |
+
Fix preview not rendering correct template and other post meta.
|
93 |
+
|
94 |
### 2.9
|
95 |
Add support for revisions and fix special character encoding.
|
96 |
|
includes/subtitle.php
CHANGED
@@ -79,6 +79,20 @@ class WP_Subtitle {
|
|
79 |
*/
|
80 |
public function get_raw_subtitle() {
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
return get_post_meta( $this->post_id, $this->get_post_meta_key(), true );
|
83 |
|
84 |
}
|
79 |
*/
|
80 |
public function get_raw_subtitle() {
|
81 |
|
82 |
+
if ( is_preview() ) {
|
83 |
+
|
84 |
+
if ( isset( $_GET['preview_id'] ) ) {
|
85 |
+
$p = wp_get_post_autosave( $this->post_id );
|
86 |
+
return get_post_meta( $p->ID, $this->get_post_meta_key(), true );
|
87 |
+
}
|
88 |
+
|
89 |
+
if ( $revisions = wp_get_post_revisions( $this->post_id ) ) {
|
90 |
+
$p = array_shift( $revisions );
|
91 |
+
return get_post_meta( $p->ID, $this->get_post_meta_key(), true );
|
92 |
+
}
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
return get_post_meta( $this->post_id, $this->get_post_meta_key(), true );
|
97 |
|
98 |
}
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: husobj, husani
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SLZUF4XJTS4E6
|
4 |
Tags: subtitle, content, title, subheading, subhead, alternate title
|
5 |
Requires at least: 3.7
|
6 |
-
Tested up to: 4.7.
|
7 |
-
Stable tag: 2.9
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
10 |
|
@@ -102,6 +102,9 @@ The plugin is [hosted on GitHub](https://github.com/benhuson/wp-subtitle) and pu
|
|
102 |
|
103 |
= Unreleased =
|
104 |
|
|
|
|
|
|
|
105 |
= 2.9 =
|
106 |
* Add support for post revisions. Props [Fabian Marz](https://github.com/fabianmarz).
|
107 |
* As of WordPress 4.3 no need to esc_attr() AND htmlentities() - can mess up special characters.
|
@@ -176,6 +179,9 @@ The plugin is [hosted on GitHub](https://github.com/benhuson/wp-subtitle) and pu
|
|
176 |
|
177 |
== Upgrade Notice ==
|
178 |
|
|
|
|
|
|
|
179 |
= 2.9 =
|
180 |
Add support for revisions and fix special character encoding.
|
181 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SLZUF4XJTS4E6
|
4 |
Tags: subtitle, content, title, subheading, subhead, alternate title
|
5 |
Requires at least: 3.7
|
6 |
+
Tested up to: 4.7.5
|
7 |
+
Stable tag: 2.9.1
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
10 |
|
102 |
|
103 |
= Unreleased =
|
104 |
|
105 |
+
= 2.9.1 =
|
106 |
+
* Fix preview not rendering correct template and other post meta.
|
107 |
+
|
108 |
= 2.9 =
|
109 |
* Add support for post revisions. Props [Fabian Marz](https://github.com/fabianmarz).
|
110 |
* As of WordPress 4.3 no need to esc_attr() AND htmlentities() - can mess up special characters.
|
179 |
|
180 |
== Upgrade Notice ==
|
181 |
|
182 |
+
= 2.9.1 =
|
183 |
+
Fix preview not rendering correct template and other post meta.
|
184 |
+
|
185 |
= 2.9 =
|
186 |
Add support for revisions and fix special character encoding.
|
187 |
|
wp-subtitle.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: WP Subtitle
|
5 |
Plugin URI: http://wordpress.org/plugins/wp-subtitle/
|
6 |
Description: Adds a subtitle field to pages and posts. Possible to add support for custom post types.
|
7 |
-
Version: 2.9
|
8 |
Author: Ben Huson, Husani Oakley
|
9 |
Author URI: https://github.com/benhuson/wp-subtitle
|
10 |
License: GPLv2
|
@@ -67,35 +67,11 @@ class WPSubtitle {
|
|
67 |
* @internal
|
68 |
*/
|
69 |
public static function _add_default_post_type_support() {
|
|
|
70 |
add_post_type_support( 'page', 'wps_subtitle' );
|
71 |
add_post_type_support( 'post', 'wps_subtitle' );
|
72 |
add_post_type_support( 'revision', 'wps_subtitle' );
|
73 |
|
74 |
-
add_filter( 'the_preview', array( 'WPSubtitle', 'the_preview' ), 10, 2 );
|
75 |
-
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Returns the autosaved data to make changes visible in preview mode.
|
80 |
-
*
|
81 |
-
* @since 2.9
|
82 |
-
*
|
83 |
-
* @param object $post Post object.
|
84 |
-
* @param object $query Query object.
|
85 |
-
* @return WP_Post|false The autosaved data or false on failure or when no autosave exists.
|
86 |
-
*/
|
87 |
-
public static function the_preview( $post, $query ) {
|
88 |
-
|
89 |
-
if ( isset( $_GET['preview_id'] ) ) {
|
90 |
-
return wp_get_post_autosave( $post->ID );
|
91 |
-
}
|
92 |
-
|
93 |
-
if ( $revisions = wp_get_post_revisions( $post->ID ) ) {
|
94 |
-
return array_shift( $revisions );
|
95 |
-
}
|
96 |
-
|
97 |
-
return $post;
|
98 |
-
|
99 |
}
|
100 |
|
101 |
/**
|
4 |
Plugin Name: WP Subtitle
|
5 |
Plugin URI: http://wordpress.org/plugins/wp-subtitle/
|
6 |
Description: Adds a subtitle field to pages and posts. Possible to add support for custom post types.
|
7 |
+
Version: 2.9.1
|
8 |
Author: Ben Huson, Husani Oakley
|
9 |
Author URI: https://github.com/benhuson/wp-subtitle
|
10 |
License: GPLv2
|
67 |
* @internal
|
68 |
*/
|
69 |
public static function _add_default_post_type_support() {
|
70 |
+
|
71 |
add_post_type_support( 'page', 'wps_subtitle' );
|
72 |
add_post_type_support( 'post', 'wps_subtitle' );
|
73 |
add_post_type_support( 'revision', 'wps_subtitle' );
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
/**
|