Version Description
- Security Update: Sanitize
$_REQUEST
and$_GET
when establishing post type in the admin. - Added quick edit support for subtitle. Props Fabian Marz and sun.
- Allow subtitle post meta key to be filtered using
wps_subtitle_key
. - Add German translation. Props hatsumatsu.
Download this release
Release Info
Developer | husobj |
Plugin | WP Subtitle |
Version | 2.6 |
Comparing to | |
See all releases |
Code changes from version 2.5 to 2.6
- CHANGELOG.md +113 -0
- README.md +124 -0
- admin/admin.php +57 -5
- admin/js/admin-edit.js +38 -0
- languages/wp-subtitle-de_DE.mo +0 -0
- languages/wp-subtitle-de_DE.po +34 -0
- readme.txt +17 -7
- wp-subtitle.php +22 -4
CHANGELOG.md
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Change Log
|
2 |
+
All notable changes to this project will be documented in this file.
|
3 |
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
4 |
+
|
5 |
+
## [Unreleased]
|
6 |
+
|
7 |
+
## [2.6] - 2015-12-08
|
8 |
+
|
9 |
+
### Security
|
10 |
+
- Sanitize `$_REQUEST` and `$_GET` when establishing post type in the admin.
|
11 |
+
|
12 |
+
### Added
|
13 |
+
- Added quick edit support for subtitle. Props [Fabian Marz](https://github.com/fabianmarz) and [sun](https://github.com/sun).
|
14 |
+
- Allow subtitle post meta key to be filtered using `wps_subtitle_key`.
|
15 |
+
- Add German translation. Props [hatsumatsu](https://github.com/hatsumatsu).
|
16 |
+
|
17 |
+
## [2.5] - 2015-08-19
|
18 |
+
|
19 |
+
### Added
|
20 |
+
- Add [wp_subtitle] shortcode.
|
21 |
+
|
22 |
+
### Fixed
|
23 |
+
- Do not use variable for textdomain - causes issues for parsers.
|
24 |
+
|
25 |
+
### Changed
|
26 |
+
- Declare methods as public or private.
|
27 |
+
|
28 |
+
## [2.4.1] - 2015-06-09
|
29 |
+
|
30 |
+
### Fixed
|
31 |
+
- Fix PHP notice warning on 404 error page. Props Jay Williams.
|
32 |
+
|
33 |
+
### Changed
|
34 |
+
- Add a little space above subtitle field when below title field in admin.
|
35 |
+
|
36 |
+
## [2.4] - 2015-04-28
|
37 |
+
|
38 |
+
### Added
|
39 |
+
- Add subtitle admin column.
|
40 |
+
|
41 |
+
## [2.3.2] - 2015-02-10
|
42 |
+
|
43 |
+
### Fixed
|
44 |
+
- Show subtitle admin field when adding new post. Props Gabriel Doty.
|
45 |
+
|
46 |
+
## [2.3.1] - 2014-10-03
|
47 |
+
|
48 |
+
### Security
|
49 |
+
- Ensure subtitles are sanitized when saving.
|
50 |
+
|
51 |
+
## [2.3] - 2014-09-05
|
52 |
+
|
53 |
+
### Fixed
|
54 |
+
- Prevent subtitle fields from displaying on post types for which support has not been added using add_post_type_support(). Previously the fields were displayed but the subtitle would not be saved.
|
55 |
+
- Escape subtitle admin field value - fixes issues with subtitles with quotes.
|
56 |
+
|
57 |
+
## [2.2] - 2014-07-02
|
58 |
+
|
59 |
+
### Added
|
60 |
+
- Added 'wps_subtitle_use_meta_box' filter to allow the edit field to be displayed in a meta box (the old way).
|
61 |
+
|
62 |
+
### Changed
|
63 |
+
- Moved subtitle field from meta box to below title field in WordPress 3.5+ (props Tor Morten)
|
64 |
+
|
65 |
+
## [2.1] - 2014-03-12
|
66 |
+
|
67 |
+
### Added
|
68 |
+
- Ready for translation - .pot file added.
|
69 |
+
- Added deprecated function warnings if WP_DEBUG enabled.
|
70 |
+
|
71 |
+
### Fixed
|
72 |
+
- Fix static method warnings.
|
73 |
+
|
74 |
+
### Changed
|
75 |
+
- Only include admin functionality when needed.
|
76 |
+
|
77 |
+
## [2.0.1] - 2013-09-18
|
78 |
+
|
79 |
+
### Fixed
|
80 |
+
- Use `<?php` instead of just `<?`.
|
81 |
+
|
82 |
+
### Changed
|
83 |
+
- Break out some of the code into separate functions.
|
84 |
+
|
85 |
+
## [2.0] - 2013-07-29
|
86 |
+
|
87 |
+
### Added
|
88 |
+
- Added custom post type support - use add_post_type_support( '{post_type}', 'wps_subtitle' ).
|
89 |
+
- Added 'wps_meta_box_title' filter.
|
90 |
+
- Added 'wps_subtitle' filter.
|
91 |
+
- Added 'wps_subtitle_field_description' filter.
|
92 |
+
|
93 |
+
### Fixed
|
94 |
+
- Fixed bug in more recent versions of WordPress.
|
95 |
+
|
96 |
+
## [1.0] - 2013-07-27
|
97 |
+
|
98 |
+
### Added
|
99 |
+
- First version.
|
100 |
+
|
101 |
+
[Unreleased]: https://github.com/benhuson/wp-subtitle/compare/2.6...HEAD
|
102 |
+
[2.6]: https://github.com/benhuson/wp-subtitle/compare/2.5...2.6
|
103 |
+
[2.5]: https://github.com/benhuson/wp-subtitle/compare/2.4.1...2.5
|
104 |
+
[2.4.1]: https://github.com/benhuson/wp-subtitle/compare/2.4...2.4.1
|
105 |
+
[2.4]: https://github.com/benhuson/wp-subtitle/compare/2.3.2...2.4
|
106 |
+
[2.3.2]: https://github.com/benhuson/wp-subtitle/compare/2.3.1...2.3.2
|
107 |
+
[2.3.1]: https://github.com/benhuson/wp-subtitle/compare/2.3...2.3.1
|
108 |
+
[2.3]: https://github.com/benhuson/wp-subtitle/compare/2.2...2.3
|
109 |
+
[2.2]: https://github.com/benhuson/wp-subtitle/compare/2.1...2.2
|
110 |
+
[2.1]: https://github.com/benhuson/wp-subtitle/compare/2.0.1...2.1
|
111 |
+
[2.0.1]: https://github.com/benhuson/wp-subtitle/compare/2.0...2.0.1
|
112 |
+
[2.0]: https://github.com/benhuson/wp-subtitle/compare/1.0...2.0
|
113 |
+
[1.0]: https://github.com/benhuson/wp-subtitle/tree/1.0
|
README.md
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
WP Subtitle
|
2 |
+
===========
|
3 |
+
|
4 |
+
Add subtitles (subheadings) to your pages, posts or custom post types.
|
5 |
+
|
6 |
+
The WP Subtitle plugin allows your pages and posts to contain a subtitle. Also called a sub-heading, this this short line of text is meant to appear beneath a post's (or page's) title, but can be inserted in your template wherever you choose.
|
7 |
+
|
8 |
+
`<?php the_subtitle(); ?>` is used for inside The Loop. If you wish to get a page/post's subtitle outside The Loop, use `<?php get_the_subtitle( $post ); ?>`, where $post is a post object or ID ($post->ID).
|
9 |
+
|
10 |
+
### Parameters
|
11 |
+
|
12 |
+
Just like WP's built-in `<?php the_title(); ?>` method, `<?php the_subtitle(); ?>` tag accepts three parameters:
|
13 |
+
|
14 |
+
**$before**
|
15 |
+
*(string)* Text to place before the subtitle. Defaults to "".
|
16 |
+
|
17 |
+
**$after**
|
18 |
+
*(string)* Text to place after the subtitle. Defaults to "".
|
19 |
+
|
20 |
+
**$echo**
|
21 |
+
*(boolean)* If true, display the subtitle in HTML. If false, return the subtitle for use in PHP. Defaults to true.
|
22 |
+
|
23 |
+
Things are slightly different in `<?php get_the_subtitle(); ?>`:
|
24 |
+
|
25 |
+
**$post**
|
26 |
+
*(int|object)* Post, page or custom post type object or ID.
|
27 |
+
|
28 |
+
**$before**
|
29 |
+
*(string)* Text to place before the subtitle. Defaults to "".
|
30 |
+
|
31 |
+
**$after**
|
32 |
+
*(string)* Text to place after the subtitle. Defaults to "".
|
33 |
+
|
34 |
+
**$echo**
|
35 |
+
*(boolean)* If true, display the subtitle in HTML. If false, return the subtitle for use in PHP. Defaults to true.
|
36 |
+
|
37 |
+
For full details on the template tags and their arguments, [view the documentation here](https://github.com/benhuson/wp-subtitle/wiki).
|
38 |
+
|
39 |
+
By default, subtitle are supported by both posts and pages. To add support for custom post types use add_post_type_support( 'my_post_type', 'wps_subtitle' ).
|
40 |
+
|
41 |
+
Installation
|
42 |
+
------------
|
43 |
+
|
44 |
+
1. Upload the WP Subtitle plugin to your WordPress site in the `/wp-content/plugins` folder or install via the WordPress admin.
|
45 |
+
1. Activate it from the Wordpress plugin admin screen.
|
46 |
+
1. Edit your page and/or post template and use the `<?php the_subtitle(); ?>` template tag where you'd like the subtitle to appear.
|
47 |
+
|
48 |
+
For full details on the template tags and their arguments, [view the documentation here](https://github.com/benhuson/wp-subtitle/wiki).
|
49 |
+
|
50 |
+
Frequently Asked Questions
|
51 |
+
--------------------------
|
52 |
+
|
53 |
+
__What does WP Subtitle do?__
|
54 |
+
|
55 |
+
The plugin adds a Subtitle field when editing posts or pages. The subtitle is stores as a custom field (post meta data) and can be output using template tags.
|
56 |
+
|
57 |
+
__Where does WP Subtitle store the subtitles?__
|
58 |
+
|
59 |
+
All subtitles are stored as post meta data. Deactivating this plugin will not remove those fields.
|
60 |
+
|
61 |
+
__How do I add the subtitle to my pages?__
|
62 |
+
|
63 |
+
Refer to [the documentation](https://github.com/benhuson/wp-subtitle/wiki).
|
64 |
+
|
65 |
+
__How do I add support for custom post types?__
|
66 |
+
|
67 |
+
To add support for custom post types use add_post_type_support( 'my_post_type', 'wps_subtitle' ):
|
68 |
+
|
69 |
+
`
|
70 |
+
function my_wp_subtitle_page_part_support() {
|
71 |
+
add_post_type_support( 'my_post_type', 'wps_subtitle' );
|
72 |
+
}
|
73 |
+
add_action( 'init', 'my_wp_subtitle_page_part_support' );
|
74 |
+
`
|
75 |
+
|
76 |
+
__Where can I get help?__
|
77 |
+
|
78 |
+
Please post support requests and questions in the [WordPress.org Support](http://wordpress.org/support/plugin/wp-subtitle) forum.
|
79 |
+
|
80 |
+
__How should I report a bug?__
|
81 |
+
|
82 |
+
Please submit bugs/errors directly to the [GitHub Issues](https://github.com/benhuson/wp-subtitle/issues) list.
|
83 |
+
|
84 |
+
__How can I contribute code?__
|
85 |
+
|
86 |
+
The plugin is [hosted on GitHub](https://github.com/benhuson/wp-subtitle) and pull requests are welcome.
|
87 |
+
|
88 |
+
Upgrade Notice
|
89 |
+
--------------
|
90 |
+
|
91 |
+
### 2.6
|
92 |
+
Added quick edit support for subtitle. Security Update: Sanitize `$_REQUEST` and `$_GET` when establishing post type in the admin.
|
93 |
+
|
94 |
+
### 2.5
|
95 |
+
Add [wp_subtitle] shortcode. Do not use variable for textdomain - causes issues for parsers.
|
96 |
+
|
97 |
+
### 2.4.1
|
98 |
+
Fix PHP notice warning on 404 error page.
|
99 |
+
|
100 |
+
### 2.4
|
101 |
+
Add subtitle admin column.
|
102 |
+
|
103 |
+
### 2.3.1
|
104 |
+
Security Update: Ensure subtitles are sanitized when saving.
|
105 |
+
|
106 |
+
### 2.3
|
107 |
+
Prevent subtitle fields from displaying on unsupported post types and fix issue with quotes in subtitles.
|
108 |
+
|
109 |
+
### 2.2
|
110 |
+
Subtitle field moved to below title field (only in WordPress 3.5+)
|
111 |
+
|
112 |
+
### 2.1
|
113 |
+
Fixed static method warnings and only load admin functionality when needed.
|
114 |
+
|
115 |
+
### 2.0
|
116 |
+
Added custom post type support and support for more recent versions of WordPress.
|
117 |
+
|
118 |
+
### 1.0
|
119 |
+
Initial release.
|
120 |
+
|
121 |
+
Changelog
|
122 |
+
---------
|
123 |
+
|
124 |
+
View a list of all plugin changes in [CHANGELOG.md](https://github.com/benhuson/wp-subtitle/blob/master/CHANGELOG.md).
|
admin/admin.php
CHANGED
@@ -22,6 +22,7 @@ class WPSubtitle_Admin {
|
|
22 |
|
23 |
add_action( 'admin_init', array( 'WPSubtitle_Admin', '_admin_init' ) );
|
24 |
add_action( 'save_post', array( 'WPSubtitle_Admin', '_save_post' ) );
|
|
|
25 |
}
|
26 |
|
27 |
/**
|
@@ -37,10 +38,10 @@ class WPSubtitle_Admin {
|
|
37 |
// Get post type
|
38 |
$post_type = '';
|
39 |
|
40 |
-
if ( isset( $
|
41 |
-
$post_type = $
|
42 |
} elseif ( isset( $_GET['post'] ) ) {
|
43 |
-
$post_type = get_post_type( $_GET['post'] );
|
44 |
} elseif ( in_array( $pagenow, array( 'post-new.php', 'edit.php' ) ) ) {
|
45 |
$post_type = 'post';
|
46 |
}
|
@@ -56,9 +57,40 @@ class WPSubtitle_Admin {
|
|
56 |
|
57 |
add_filter( 'manage_edit-' . $post_type . '_columns', array( 'WPSubtitle_Admin', 'manage_subtitle_columns' ) );
|
58 |
add_action( 'manage_' . $post_type . '_posts_custom_column', array( 'WPSubtitle_Admin', 'manage_subtitle_columns_content' ), 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
|
|
|
|
60 |
}
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
|
64 |
/**
|
@@ -95,11 +127,28 @@ class WPSubtitle_Admin {
|
|
95 |
public static function manage_subtitle_columns_content( $column_name, $post_id ) {
|
96 |
|
97 |
if ( $column_name == 'wps_subtitle' ) {
|
98 |
-
|
|
|
99 |
}
|
100 |
|
101 |
}
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
/**
|
104 |
* Add Admin Styles
|
105 |
*
|
@@ -135,6 +184,9 @@ class WPSubtitle_Admin {
|
|
135 |
#subtitlediv.top #subtitledescription {
|
136 |
margin: 5px 10px 0 10px;
|
137 |
}
|
|
|
|
|
|
|
138 |
</style>
|
139 |
<?php
|
140 |
}
|
@@ -238,7 +290,7 @@ class WPSubtitle_Admin {
|
|
238 |
|
239 |
// Save data
|
240 |
if ( isset( $_POST['wps_subtitle'] ) ) {
|
241 |
-
update_post_meta( $post_id,
|
242 |
}
|
243 |
}
|
244 |
|
22 |
|
23 |
add_action( 'admin_init', array( 'WPSubtitle_Admin', '_admin_init' ) );
|
24 |
add_action( 'save_post', array( 'WPSubtitle_Admin', '_save_post' ) );
|
25 |
+
add_action( 'admin_enqueue_scripts', array( 'WPSubtitle_Admin', '_add_admin_scripts' ) );
|
26 |
}
|
27 |
|
28 |
/**
|
38 |
// Get post type
|
39 |
$post_type = '';
|
40 |
|
41 |
+
if ( isset( $_REQUEST['post_type'] ) ) {
|
42 |
+
$post_type = sanitize_text_field( $_REQUEST['post_type'] );
|
43 |
} elseif ( isset( $_GET['post'] ) ) {
|
44 |
+
$post_type = get_post_type( absint( $_GET['post'] ) );
|
45 |
} elseif ( in_array( $pagenow, array( 'post-new.php', 'edit.php' ) ) ) {
|
46 |
$post_type = 'post';
|
47 |
}
|
57 |
|
58 |
add_filter( 'manage_edit-' . $post_type . '_columns', array( 'WPSubtitle_Admin', 'manage_subtitle_columns' ) );
|
59 |
add_action( 'manage_' . $post_type . '_posts_custom_column', array( 'WPSubtitle_Admin', 'manage_subtitle_columns_content' ), 10, 2 );
|
60 |
+
add_action( 'quick_edit_custom_box', array( 'WPSubtitle_Admin', 'quick_edit_custom_box' ), 10, 2 );
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Add subtitle input to quick edit.
|
67 |
+
*
|
68 |
+
* @since 2.6
|
69 |
+
*
|
70 |
+
* @uses add_action( 'quick_edit_custom_box' )
|
71 |
+
*
|
72 |
+
* @param string $column_name Column name.
|
73 |
+
* @param string $post_type Post type
|
74 |
+
*/
|
75 |
+
public static function quick_edit_custom_box( $column_name, $post_type ) {
|
76 |
|
77 |
+
if ( $column_name !== 'wps_subtitle' ) {
|
78 |
+
return;
|
79 |
}
|
80 |
|
81 |
+
wp_nonce_field( 'wp-subtitle', 'wps_noncename' );
|
82 |
+
|
83 |
+
?>
|
84 |
+
<fieldset class="inline-edit-col-left inline-edit-col-left-wps-subtitle">
|
85 |
+
<div class="inline-edit-col column-<?php echo $column_name; ?>">
|
86 |
+
<label>
|
87 |
+
<span class="title"><?php esc_html_e( 'Subtitle', 'wp-subtitle' ); ?></span>
|
88 |
+
<span class="input-text-wrap"><input type="text" name="wps_subtitle" class="wps_subtitle" value=""></span>
|
89 |
+
</label>
|
90 |
+
</div>
|
91 |
+
</fieldset>
|
92 |
+
<?php
|
93 |
+
|
94 |
}
|
95 |
|
96 |
/**
|
127 |
public static function manage_subtitle_columns_content( $column_name, $post_id ) {
|
128 |
|
129 |
if ( $column_name == 'wps_subtitle' ) {
|
130 |
+
$subtitle = get_the_subtitle( $post_id, '', '', false );
|
131 |
+
echo '<span data-wps_subtitle="' . esc_attr( $subtitle ) . '">' . esc_html( $subtitle ) . '</span>';
|
132 |
}
|
133 |
|
134 |
}
|
135 |
|
136 |
+
/**
|
137 |
+
* Add Admin scripts.
|
138 |
+
*
|
139 |
+
* @since 2.6
|
140 |
+
* @internal
|
141 |
+
*/
|
142 |
+
public static function _add_admin_scripts( $hook ) {
|
143 |
+
|
144 |
+
if ( 'edit.php' != $hook ) {
|
145 |
+
return;
|
146 |
+
}
|
147 |
+
|
148 |
+
wp_enqueue_script( 'wps_subtitle', plugins_url( 'js/admin-edit.js', __FILE__ ), false, null, true );
|
149 |
+
|
150 |
+
}
|
151 |
+
|
152 |
/**
|
153 |
* Add Admin Styles
|
154 |
*
|
184 |
#subtitlediv.top #subtitledescription {
|
185 |
margin: 5px 10px 0 10px;
|
186 |
}
|
187 |
+
.quick-edit-row-post .inline-edit-col-left-wps-subtitle {
|
188 |
+
clear: left;
|
189 |
+
}
|
190 |
</style>
|
191 |
<?php
|
192 |
}
|
290 |
|
291 |
// Save data
|
292 |
if ( isset( $_POST['wps_subtitle'] ) ) {
|
293 |
+
update_post_meta( $post_id, WPSubtitle::_get_post_meta_key( $post_id ), wp_kses_post( $_POST['wps_subtitle'] ) );
|
294 |
}
|
295 |
}
|
296 |
|
admin/js/admin-edit.js
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* @package WP Subtitle
|
3 |
+
* @subpackage JavaScript > Admin Edit
|
4 |
+
*/
|
5 |
+
|
6 |
+
( function ( $, inlineEditPost ) {
|
7 |
+
|
8 |
+
// inlineEditPost does not invoke any events, but does ensure to stop
|
9 |
+
// propagation to all other event handlers; swap it out.
|
10 |
+
inlineEditPost.editPreWpSubtitle = inlineEditPost.edit;
|
11 |
+
inlineEditPost.edit = function ( id ) {
|
12 |
+
|
13 |
+
// Invoke original edit event handler.
|
14 |
+
this.editPreWpSubtitle.apply( this, arguments );
|
15 |
+
|
16 |
+
// Get the post ID
|
17 |
+
var post_id = 0;
|
18 |
+
if ( typeof( id ) == 'object' ) {
|
19 |
+
post_id = parseInt( this.getId( id ) );
|
20 |
+
}
|
21 |
+
|
22 |
+
if ( post_id > 0 ) {
|
23 |
+
|
24 |
+
// Define the edit row
|
25 |
+
var edit_row = $( '#edit-' + post_id );
|
26 |
+
var post_row = $( '#post-' + post_id );
|
27 |
+
|
28 |
+
// Get the data
|
29 |
+
var subtitle = $( '.column-wps_subtitle', post_row ).find( '[data-wps_subtitle]' ).data( 'wps_subtitle' );
|
30 |
+
|
31 |
+
// Populate the data
|
32 |
+
$( ':input[name="wps_subtitle"]', edit_row ).val( subtitle );
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
} ) ( jQuery, inlineEditPost );
|
languages/wp-subtitle-de_DE.mo
ADDED
Binary file
|
languages/wp-subtitle-de_DE.po
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WP Subtitle\n"
|
4 |
+
"POT-Creation-Date: 2015-07-02 06:57-0000\n"
|
5 |
+
"PO-Revision-Date: \n"
|
6 |
+
"Last-Translator: me <me@fake.it>\n"
|
7 |
+
"Language-Team: \n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
12 |
+
"X-Generator: Poedit 1.7.3\n"
|
13 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
14 |
+
"X-Poedit-KeywordsList: __;_e;_x;_ex\n"
|
15 |
+
"X-Poedit-Basepath: .\n"
|
16 |
+
"Language: de_DE\n"
|
17 |
+
"X-Poedit-SearchPath-0: ..\n"
|
18 |
+
|
19 |
+
#: ../admin/admin.php:79 ../admin/admin.php:150
|
20 |
+
msgid "Subtitle"
|
21 |
+
msgstr "Untertitel"
|
22 |
+
|
23 |
+
#: ../admin/admin.php:200
|
24 |
+
msgid "Enter subtitle here"
|
25 |
+
msgstr "Untertitel hier eingeben"
|
26 |
+
|
27 |
+
#: ../admin/pointers.php:146
|
28 |
+
#, php-format
|
29 |
+
msgid "%s Field"
|
30 |
+
msgstr "%sfeld"
|
31 |
+
|
32 |
+
#: ../admin/pointers.php:147
|
33 |
+
msgid "This field has moved from a meta box to below the post title."
|
34 |
+
msgstr "Dieses Feld wurde aus einer Metabox unter den Beitragstitel verschoben."
|
readme.txt
CHANGED
@@ -2,9 +2,10 @@
|
|
2 |
Contributors: husobj, husani
|
3 |
Tags: subtitle, content, title, subheading, subhead, alternate title
|
4 |
Requires at least: 3.7
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 2.
|
7 |
-
License:
|
|
|
8 |
|
9 |
Add subtitles (subheadings) to your pages, posts or custom post types.
|
10 |
|
@@ -98,10 +99,16 @@ The plugin is [hosted on GitHub](https://github.com/benhuson/wp-subtitle) and pu
|
|
98 |
|
99 |
== Changelog ==
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
= 2.5 =
|
102 |
* Add [wp_subtitle] shortcode.
|
103 |
-
* Declare methods as public or private.
|
104 |
* Do not use variable for textdomain - causes issues for parsers.
|
|
|
105 |
|
106 |
= 2.4.1 =
|
107 |
* Fix PHP notice warning on 404 error page. Props Jay Williams.
|
@@ -121,14 +128,14 @@ The plugin is [hosted on GitHub](https://github.com/benhuson/wp-subtitle) and pu
|
|
121 |
* Escape subtitle admin field value - fixes issues with subtitles with quotes.
|
122 |
|
123 |
= 2.2 =
|
124 |
-
* Moved subtitle field from meta box to below title field in WordPress 3.5+ (props Tor Morten)
|
125 |
* Added 'wps_subtitle_use_meta_box' filter to allow the edit field to be displayed in a meta box (the old way).
|
|
|
126 |
|
127 |
= 2.1 =
|
128 |
* Ready for translation - .pot file added.
|
129 |
-
* Only include admin functionality when needed.
|
130 |
* Added deprecated function warnings if WP_DEBUG enabled.
|
131 |
* Fix static method warnings.
|
|
|
132 |
|
133 |
= 2.0.1 =
|
134 |
* Use `<?php` instead of just `<?`.
|
@@ -136,16 +143,19 @@ The plugin is [hosted on GitHub](https://github.com/benhuson/wp-subtitle) and pu
|
|
136 |
|
137 |
= 2.0 =
|
138 |
* Added custom post type support - use add_post_type_support( '{post_type}', 'wps_subtitle' ).
|
139 |
-
* Fixed bug in more recent versions of WordPress.
|
140 |
* Added 'wps_meta_box_title' filter.
|
141 |
* Added 'wps_subtitle' filter.
|
142 |
* Added 'wps_subtitle_field_description' filter.
|
|
|
143 |
|
144 |
= 1.0 =
|
145 |
* First version.
|
146 |
|
147 |
== Upgrade Notice ==
|
148 |
|
|
|
|
|
|
|
149 |
= 2.5 =
|
150 |
Add [wp_subtitle] shortcode. Do not use variable for textdomain - causes issues for parsers.
|
151 |
|
2 |
Contributors: husobj, husani
|
3 |
Tags: subtitle, content, title, subheading, subhead, alternate title
|
4 |
Requires at least: 3.7
|
5 |
+
Tested up to: 4.4
|
6 |
+
Stable tag: 2.6
|
7 |
+
License: GPLv2
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
9 |
|
10 |
Add subtitles (subheadings) to your pages, posts or custom post types.
|
11 |
|
99 |
|
100 |
== Changelog ==
|
101 |
|
102 |
+
= 2.6 =
|
103 |
+
* Security Update: Sanitize `$_REQUEST` and `$_GET` when establishing post type in the admin.
|
104 |
+
* Added quick edit support for subtitle. Props [Fabian Marz](https://github.com/fabianmarz) and [sun](https://github.com/sun).
|
105 |
+
* Allow subtitle post meta key to be filtered using `wps_subtitle_key`.
|
106 |
+
* Add German translation. Props [hatsumatsu](https://github.com/hatsumatsu).
|
107 |
+
|
108 |
= 2.5 =
|
109 |
* Add [wp_subtitle] shortcode.
|
|
|
110 |
* Do not use variable for textdomain - causes issues for parsers.
|
111 |
+
* Declare methods as public or private.
|
112 |
|
113 |
= 2.4.1 =
|
114 |
* Fix PHP notice warning on 404 error page. Props Jay Williams.
|
128 |
* Escape subtitle admin field value - fixes issues with subtitles with quotes.
|
129 |
|
130 |
= 2.2 =
|
|
|
131 |
* Added 'wps_subtitle_use_meta_box' filter to allow the edit field to be displayed in a meta box (the old way).
|
132 |
+
* Moved subtitle field from meta box to below title field in WordPress 3.5+ (props Tor Morten)
|
133 |
|
134 |
= 2.1 =
|
135 |
* Ready for translation - .pot file added.
|
|
|
136 |
* Added deprecated function warnings if WP_DEBUG enabled.
|
137 |
* Fix static method warnings.
|
138 |
+
* Only include admin functionality when needed.
|
139 |
|
140 |
= 2.0.1 =
|
141 |
* Use `<?php` instead of just `<?`.
|
143 |
|
144 |
= 2.0 =
|
145 |
* Added custom post type support - use add_post_type_support( '{post_type}', 'wps_subtitle' ).
|
|
|
146 |
* Added 'wps_meta_box_title' filter.
|
147 |
* Added 'wps_subtitle' filter.
|
148 |
* Added 'wps_subtitle_field_description' filter.
|
149 |
+
* Fixed bug in more recent versions of WordPress.
|
150 |
|
151 |
= 1.0 =
|
152 |
* First version.
|
153 |
|
154 |
== Upgrade Notice ==
|
155 |
|
156 |
+
= 2.6 =
|
157 |
+
Added quick edit support for subtitle. Security Update: Sanitize `$_REQUEST` and `$_GET` when establishing post type in the admin.
|
158 |
+
|
159 |
= 2.5 =
|
160 |
Add [wp_subtitle] shortcode. Do not use variable for textdomain - causes issues for parsers.
|
161 |
|
wp-subtitle.php
CHANGED
@@ -4,10 +4,13 @@
|
|
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 |
-
|
|
|
8 |
Author URI: https://github.com/benhuson/wp-subtitle
|
9 |
-
Version: 2.5
|
10 |
License: GPLv2
|
|
|
|
|
|
|
11 |
*/
|
12 |
|
13 |
/*
|
@@ -40,10 +43,10 @@ include_once( WPSUBTITLE_DIR . 'includes/shortcode.php' );
|
|
40 |
|
41 |
// Include admin-only functionality
|
42 |
if ( is_admin() ) {
|
|
|
43 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
44 |
// Load AJAX functions here if required...
|
45 |
} else {
|
46 |
-
require_once( WPSUBTITLE_DIR . 'admin/admin.php' );
|
47 |
require_once( WPSUBTITLE_DIR . 'admin/pointers.php' );
|
48 |
}
|
49 |
}
|
@@ -131,7 +134,22 @@ class WPSubtitle {
|
|
131 |
*/
|
132 |
public static function _get_post_meta( $id = 0 ) {
|
133 |
$post = get_post( $id );
|
134 |
-
return get_post_meta( $post->ID,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
}
|
136 |
|
137 |
}
|
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.6
|
8 |
+
Author: Ben Huson, Husani Oakley
|
9 |
Author URI: https://github.com/benhuson/wp-subtitle
|
|
|
10 |
License: GPLv2
|
11 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
12 |
+
Text Domain: wp-subtitle
|
13 |
+
Domain Path: /languages
|
14 |
*/
|
15 |
|
16 |
/*
|
43 |
|
44 |
// Include admin-only functionality
|
45 |
if ( is_admin() ) {
|
46 |
+
require_once( WPSUBTITLE_DIR . 'admin/admin.php' );
|
47 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
48 |
// Load AJAX functions here if required...
|
49 |
} else {
|
|
|
50 |
require_once( WPSUBTITLE_DIR . 'admin/pointers.php' );
|
51 |
}
|
52 |
}
|
134 |
*/
|
135 |
public static function _get_post_meta( $id = 0 ) {
|
136 |
$post = get_post( $id );
|
137 |
+
return get_post_meta( $post->ID, self::_get_post_meta_key( $post->ID ), true );
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Get Post Meta Key
|
142 |
+
*
|
143 |
+
* @since 2.5.x
|
144 |
+
* @internal
|
145 |
+
*
|
146 |
+
* @param int $post Post ID.
|
147 |
+
* @return string The subtitle meta key.
|
148 |
+
*/
|
149 |
+
public static function _get_post_meta_key( $post_id = 0 ) {
|
150 |
+
|
151 |
+
return apply_filters( 'wps_subtitle_key', 'wps_subtitle', $post_id );
|
152 |
+
|
153 |
}
|
154 |
|
155 |
}
|