WP Subtitle - Version 2.0

Version Description

  • Added custom post type support - use add_post_type_support( '{post_type}', 'wps_subtitle' ).
  • Fixed bug in more recent versions of WordPress.
  • Added 'wps_meta_box_title' filter.
  • Added 'wps_subtitle' filter.
  • Added 'wps_subtitle_field_description' filter.
Download this release

Release Info

Developer husobj
Plugin Icon 128x128 WP Subtitle
Version 2.0
Comparing to
See all releases

Code changes from version 1.0 to 2.0

admin/compat_panel.inc.php DELETED
@@ -1,6 +0,0 @@
1
- <div class="dbx-b-ox-wrapper">
2
- <fieldset id="myplugin_fieldsetid" class="dbx-box">
3
- <div class="dbx-h-andle-wrapper"><h3 class="dbx-handle"><?__( 'My Post Section Title', 'myplugin_textdomain' )?></h3></div>
4
- <div class="dbx-c-ontent-wrapper"><div class="dbx-content">
5
- <?wps_showSubtitlePanel();?>
6
- </div></div></fieldset></div>
 
 
 
 
 
 
admin/css/panel.css DELETED
@@ -1,10 +0,0 @@
1
- input#wpsubtitle{
2
- position: relative;
3
- border: 1px solid #DFDFDF;
4
- font-size:1.5em;
5
- outline-color:-moz-use-text-color;
6
- outline-style:none;
7
- outline-width:medium;
8
- padding:3px 4px;
9
- width:100%;
10
- }
 
 
 
 
 
 
 
 
 
 
admin/panel.inc.php DELETED
@@ -1,2 +0,0 @@
1
- <input type="hidden" name="wps_noncename" id="wps_noncename" value="<?=wp_create_nonce('wp-subtitle')?>" />
2
- <input type="text" id="wpsubtitle" name="wps_subtitle" value="<?wps_get_the_subtitle()?>" />
 
 
readme.txt CHANGED
@@ -1,68 +1,103 @@
1
  === WP Subtitle ===
2
- Contributors: husani
3
  Tags: subtitle, content, title, subheading, subhead, alternate title
4
- Donate link: http://www.husani.com/ventures/wordpress-plugins/wp-subtitle/#donate
5
- Requires at least: 2.7
6
- Tested up to: 2.8
7
- Stable tag: 1.0
8
 
9
- Add subtitles (subheadings) to your pages and posts.
10
 
11
  == Description ==
12
 
13
  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.
14
 
15
- &lt;?the_subtitle()?&gt; is used for inside The Loop -- if you wish to get a page/post's subtitle outside The Loop, use &lt;?get_the_subtitle($id)?&gt;, where $id is the page or post's ID ($post->ID).
16
 
17
- Just like WP's built-in &lt;?the_title()?&gt; method, &lt;?the_subtitle()?&gt; tag accepts three parameters:
18
 
19
- $before
20
- (string) Text to place before the subtitle, defaults to "".
21
 
22
- $after
23
- (string) Text to place after the subtitle, defaults to "".
24
 
25
- $display
26
- (boolean) If true, display the subtitle in XHTML; if false, return the subtitle for use in PHP. Defaults to true.
27
 
28
- Things are slightly different in &lt;?get_the_subtitle()?&gt;:
 
29
 
30
- $id
31
- (integer) Post (or page) ID.
32
 
33
- $before
34
- (string) Text to place before the subtitle, defaults to "".
35
 
36
- $after
37
- (string) Text to place after the subtitle, defaults to "".
38
 
39
- $display
40
- (boolean) If true, display the subtitle in XHTML; if false, return the subtitle for use in PHP. Defaults to true.
41
 
42
- Changelog:
43
-
44
- * 1.0:
45
- - First version
46
 
 
47
 
48
  == Installation ==
49
 
50
- 1. Upload the WP Subtitle plugin to your blog (YOURBLOG/wp-content/plugins) and activate it using the Wordpress plugin admin screen.
51
- 2. Edit your page and/or post template and add &lt;?the_subtitle()?&gt; or &lt;?get_the_subtitle()?&gt; where you'd like the subtitle to appear. Pass arguments per above instructions.
 
 
 
52
 
53
  == Frequently Asked Questions ==
54
 
55
- = How does WP Subtitle work? =
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
- The plugin uses a WP's actions/hooks to add a custom field to posts and pages. Simple.
58
 
59
- = Does WP Subtitle use the Wordpress database? =
60
 
61
- Yes, all subtitles are stored as custom fields. Deactivating this plugin will not remove those firleds.
 
 
 
 
62
 
63
  == Screenshots ==
64
 
65
- 1. Post edit
66
- 2. Page edit
67
- 3. List of posts showing subtitles
68
- 4. A single page showing a subtitle
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  === WP Subtitle ===
2
+ Contributors: husani, husobj
3
  Tags: subtitle, content, title, subheading, subhead, alternate title
4
+ Requires at least: 3.0
5
+ Tested up to: 3.5.2
6
+ Stable tag: 2.0
7
+ License: GPL2
8
 
9
+ Add subtitles (subheadings) to your pages, posts or custom post types.
10
 
11
  == Description ==
12
 
13
  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.
14
 
15
+ `<?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).
16
 
17
+ = Parameters =
18
 
19
+ Just like WP's built-in `<?php the_title(); ?>` method, `<?php the_subtitle(); ?>` tag accepts three parameters:
 
20
 
21
+ **$before**
22
+ *(string)* Text to place before the subtitle. Defaults to "".
23
 
24
+ **$after**
25
+ *(string)* Text to place after the subtitle. Defaults to "".
26
 
27
+ **$echo**
28
+ *(boolean)* If true, display the subtitle in HTML. If false, return the subtitle for use in PHP. Defaults to true.
29
 
30
+ Things are slightly different in `<?php get_the_subtitle(); ?>`:
 
31
 
32
+ **$post**
33
+ *(int|object)* Post, page or custom post type object or ID.
34
 
35
+ **$before**
36
+ *(string)* Text to place before the subtitle. Defaults to "".
37
 
38
+ **$after**
39
+ *(string)* Text to place after the subtitle. Defaults to "".
40
 
41
+ **$echo**
42
+ *(boolean)* If true, display the subtitle in HTML. If false, return the subtitle for use in PHP. Defaults to true.
 
 
43
 
44
+ For full details on the template tags and their arguments, [view the documentation here](https://github.com/benhuson/wp-subtitle/wiki).
45
 
46
  == Installation ==
47
 
48
+ 1. Upload the WP Subtitle plugin to your WordPress site in the `/wp-content/plugins` folder or install via the WordPress admin.
49
+ 2. Activate it from the Wordpress plugin admin screen.
50
+ 3. Edit your page and/or post template and use the `<?php the_subtitle(); ?>` template tag where you'd like the subtitle to appear.
51
+
52
+ For full details on the template tags and their arguments, [view the documentation here](https://github.com/benhuson/wp-subtitle/wiki).
53
 
54
  == Frequently Asked Questions ==
55
 
56
+ = What does WP Subtitle do? =
57
+
58
+ 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.
59
+
60
+ = Where does WP Subtitle store the subtitles? =
61
+
62
+ All subtitles are stored as post meta data. Deactivating this plugin will not remove those fields.
63
+
64
+ = How do I add the subtitle to my pages? =
65
+
66
+ Refer to [the documentation](https://github.com/benhuson/wp-subtitle/wiki).
67
+
68
+ = Where can I get help? =
69
 
70
+ Please post support requests and questions in the [WordPress.org Support](http://wordpress.org/support/plugin/wp-subtitle) forum.
71
 
72
+ = How should I report a bug? =
73
 
74
+ Please submit bugs/errors directly to the [GitHub Issues](https://github.com/benhuson/wp-subtitle/issues) list.
75
+
76
+ = How can I contribute code? =
77
+
78
+ The plugin is [hosted on GitHub](https://github.com/benhuson/wp-subtitle) and pull requests are welcome.
79
 
80
  == Screenshots ==
81
 
82
+ 1. Edit post screen
83
+ 2. A single page showing a subtitle
84
+
85
+ == Changelog ==
86
+
87
+ = 2.0 =
88
+ * Added custom post type support - use add_post_type_support( '{post_type}', 'wps_subtitle' ).
89
+ * Fixed bug in more recent versions of WordPress.
90
+ * Added 'wps_meta_box_title' filter.
91
+ * Added 'wps_subtitle' filter.
92
+ * Added 'wps_subtitle_field_description' filter.
93
+
94
+ = 1.0 =
95
+ * First version.
96
+
97
+ == Upgrade Notice ==
98
+
99
+ = 2.0 =
100
+ * Added custom post type support and support for more recent versions of WordPress.
101
+
102
+ = 1.0 =
103
+ * Initial release.
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file
screenshot-4.png DELETED
Binary file
wp-subtitle.php CHANGED
@@ -1,130 +1,287 @@
1
  <?
 
2
  /*
3
  Plugin Name: WP Subtitle
4
- Plugin URI: http://www.husani.com/ventures/wordpress-plugins/wp-subtitle/
5
- Description: Add a subtitle to pages and posts. Place &lt;?=the_subtitle()?&gt; where you'd like the subtitle to appear. Similar to the_title, you can pass before, after, and display arguments. Documentation included in this plugin's readme file. Get help at <a href="http://forums.husani.com/forum/wp-subtitle/" target="_blank">support forums</a> and sign up for the <a href="http://www.husani.com/ventures/wordpress-plugins/wp-subtitle/mailing-list/" target="_blank">mailing list</a> to receive updates and news about WP Subtitle. By <a href="http://www.husani.com" target="_blank">Husani Oakley</a>.
6
- Author
7
- Version: 1.0
 
 
8
  */
9
 
10
- /* Copyright 2009 Husani Oakley (email : wordpressplugins@husani.com)
 
11
 
12
- This program is free software; you can redistribute it and/or modify
13
- it under the terms of the GNU General Public License as published by
14
- the Free Software Foundation; either version 2 of the License, or
15
- (at your option) any later version.
16
 
17
- This program is distributed in the hope that it will be useful,
18
- but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- GNU General Public License for more details.
21
 
22
- You should have received a copy of the GNU General Public License
23
- along with this program; if not, write to the Free Software
24
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
 
27
- /**
28
- * query db and echo page/post subtitle, if any
29
- */
30
- function wps_get_the_subtitle(){
31
- global $post;
32
- echo get_post_meta($post->ID, "wps_subtitle", true);
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
- /** HOOKS */
36
- add_action('admin_menu', 'wps_addPanelXHTML');
37
- add_action('save_post', 'wps_saveSubtitle');
 
38
 
39
- /** FUNCTIONS FOR HOOKS */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  /**
42
- * display xhtml for subtitle panel
 
 
 
 
 
43
  */
44
- function wps_addPanelXHTML(){
45
- if( function_exists( 'add_meta_box' )) {
46
- add_meta_box('wps_panel', 'Page Subtitle', 'wps_showSubtitlePanel', 'page', 'normal', 'high');
47
- add_meta_box('wps_panel', 'Post Subtitle', 'wps_showSubtitlePanel', 'post', 'normal', 'high');
48
- } else {
49
- add_action('dbx_page_advanced', 'wps_showSubtitlePanelOld');
50
- add_action('dbx_post_advanced', 'wps_showSubtitlePanelOld');
51
- }
52
- //include css if admin
53
- if(is_admin()){
54
- add_action('admin_print_styles', 'wps_addPanelCSS');
55
- }
56
  }
57
 
58
  /**
59
- * include CSS for subtitle panel
 
 
 
60
  */
61
- function wps_addPanelCSS(){
62
- $css = WP_PLUGIN_URL . '/wp-subtitle/admin/css/panel.css';
63
- wp_register_style('wps_css', $css);
64
- wp_enqueue_style( 'wps_css');
65
  }
66
 
67
  /**
68
- * include XHTML for form inside panel
 
 
 
69
  */
70
- function wps_showSubtitlePanel(){
71
- include ABSPATH . PLUGINDIR . "/wp-subtitle/admin/panel.inc.php";
72
  }
73
 
74
  /**
75
- * for pre-2.5, include shell for panel
 
 
 
76
  */
77
- function wps_showSubtitlePanelOld(){
78
- include ABSPATH . PLUGINDIR . "/wp-subtitle/admin/compat_panel.inc.php";
79
  }
80
 
81
  /**
82
- * store subtitle content in db as custom field
 
 
 
83
  */
84
- function wps_saveSubtitle($post_id){
85
- //verify
86
- if (!wp_verify_nonce( $_POST['wps_noncename'], 'wp-subtitle')) {
87
- return $post_id;
88
- }
89
- if ('page' == $_POST['post_type']){
90
- if (!current_user_can('edit_page', $post_id)){
91
- return $post_id;
92
- }
93
- } else {
94
- if (!current_user_can('edit_post', $post_id)){
95
- return $post_id;
96
- }
97
- }
98
- //save data
99
- if(!update_post_meta($post_id, "wps_subtitle", $_POST["wps_subtitle"])){
100
- add_post_meta($post_id, "wps_subtitle", $_POST["wps_subtitle"]);
101
- }
102
  }
103
 
104
  /**
105
- * return subtitle from post inside The Loop
 
 
 
106
  */
107
- function the_subtitle($before="", $after="", $display=true){
108
- global $post;
109
- $subtitle = $before . get_post_meta($post->ID, "wps_subtitle", true) . $after;
110
- if($display){
111
- echo $subtitle;
112
- } else {
113
- return $subtitle;
114
- }
115
  }
116
 
117
  /**
118
- * return (or display) subtitle from post with ID passed as argument
 
 
 
 
 
 
 
 
 
119
  */
120
- function get_the_subtitle($id, $before="", $after="", $display=true){
121
- $subtitle = $before . get_post_meta($id, "wps_subtitle", true) . $after;
122
- if($display){
123
- echo $subtitle;
124
- } else {
125
- return $subtitle;
126
- }
127
  }
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
- ?>
 
 
 
 
 
 
 
1
  <?
2
+
3
  /*
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
+ Author: Husani Oakley, Ben Huson
8
+ Author URI: https://github.com/benhuson/wp-subtitle
9
+ Version: 2.0
10
+ License: GPLv2
11
  */
12
 
13
+ /*
14
+ Copyright 2009 Husani Oakley (email : wordpressplugins@husani.com)
15
 
16
+ This program is free software; you can redistribute it and/or modify
17
+ it under the terms of the GNU General Public License as published by
18
+ the Free Software Foundation; either version 2 of the License, or
19
+ (at your option) any later version.
20
 
21
+ This program is distributed in the hope that it will be useful,
22
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ GNU General Public License for more details.
25
 
26
+ You should have received a copy of the GNU General Public License
27
+ along with this program; if not, write to the Free Software
28
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29
  */
30
 
31
+ add_action( 'plugins_loaded', array( 'WPSubtitle', '_init' ) );
32
+
33
+ class WPSubtitle {
34
+
35
+ /**
36
+ * Init
37
+ *
38
+ * @since 2.0
39
+ * @internal
40
+ *
41
+ * @uses WPSubtitle::_add_default_post_type_support()
42
+ * @uses WPSubtitle::_add_meta_boxes()
43
+ * @uses WPSubtitle::_save_post()
44
+ */
45
+ function _init() {
46
+ add_action( 'init', array( 'WPSubtitle', '_add_default_post_type_support' ), 5 );
47
+ add_action( 'add_meta_boxes', array( 'WPSubtitle', '_add_meta_boxes' ) );
48
+ add_action( 'save_post', array( 'WPSubtitle', '_save_post' ) );
49
+ }
50
+
51
+ /**
52
+ * Add Default Post Type Support
53
+ *
54
+ * @since 2.0
55
+ * @internal
56
+ */
57
+ function _add_default_post_type_support() {
58
+ add_post_type_support( 'page', 'wps_subtitle' );
59
+ add_post_type_support( 'post', 'wps_subtitle' );
60
+ }
61
+
62
+ /**
63
+ * Add Meta Boxes
64
+ *
65
+ * @since 2.0
66
+ * @internal
67
+ *
68
+ * @uses WPSubtitle::get_supported_post_types()
69
+ * @uses apply_filters( 'wps_meta_box_title' )
70
+ * @uses WPSubtitle::_add_subtitle_meta_box()
71
+ */
72
+ function _add_meta_boxes() {
73
+ $post_types = WPSubtitle::get_supported_post_types();
74
+ foreach ( $post_types as $post_type ) {
75
+ $meta_box_title = apply_filters( 'wps_meta_box_title', 'Subtitle', $post_type );
76
+ add_meta_box( 'wps_subtitle_panel', __( $meta_box_title ), array( 'WPSubtitle', '_add_subtitle_meta_box' ), $post_type, 'normal', 'high' );
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Add Subtitle Meta Box
82
+ *
83
+ * @since 2.0
84
+ * @internal
85
+ *
86
+ * @uses WPSubtitle::_get_post_meta()
87
+ * @uses apply_filters( 'wps_subtitle_field_description' )
88
+ */
89
+ function _add_subtitle_meta_box() {
90
+ global $post;
91
+ echo '<input type="hidden" name="wps_noncename" id="wps_noncename" value="' . wp_create_nonce( 'wp-subtitle' ) . '" />
92
+ <input type="text" id="wpsubtitle" name="wps_subtitle" value="' . WPSubtitle::_get_post_meta( $post->ID ) . '" style="width:99%;" />';
93
+ echo apply_filters( 'wps_subtitle_field_description', '', $post );
94
+ }
95
+
96
+ /**
97
+ * Save Subtitle
98
+ *
99
+ * @since 2.0
100
+ * @internal
101
+ *
102
+ * @uses WPSubtitle::get_supported_post_types()
103
+ *
104
+ * @param int $post_id Post ID or object.
105
+ */
106
+ function _save_post( $post_id ) {
107
 
108
+ // Verify if this is an auto save routine.
109
+ // If it is our form has not been submitted, so we dont want to do anything
110
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
111
+ return;
112
 
113
+ // Verify nonce
114
+ if ( isset( $_POST['wps_noncename'] ) && ! wp_verify_nonce( $_POST['wps_noncename'], 'wp-subtitle' ) )
115
+ return $post_id;
116
+
117
+ // Check edit capability
118
+ $abort = true;
119
+ $post_types = WPSubtitle::get_supported_post_types();
120
+ $post_types_obj = (array) get_post_types( array(
121
+ '_builtin' => false
122
+ ), 'objects' );
123
+ if ( isset( $_POST['post_type'] ) && in_array( $_POST['post_type'], $post_types ) ) {
124
+ if ( 'page' == $_POST['post_type'] && current_user_can( 'edit_page', $post_id ) )
125
+ $abort = false;
126
+ elseif ( 'post' == $_POST['post_type'] && current_user_can( 'edit_post', $post_id ) )
127
+ $abort = false;
128
+ elseif ( current_user_can( $post_types_obj[$_POST['post_type']]->cap->edit_post, $post_id ) )
129
+ $abort = false;
130
+ }
131
+ if ( $abort )
132
+ return $post_id;
133
+
134
+ // Save data
135
+ update_post_meta( $post_id, 'wps_subtitle', $_POST['wps_subtitle'] );
136
+ }
137
+
138
+ /**
139
+ * Get Supported Post Types
140
+ *
141
+ * @since 2.0
142
+ *
143
+ * @return array Array of supported post types.
144
+ */
145
+ function get_supported_post_types() {
146
+ $post_types = (array) get_post_types( array(
147
+ '_builtin' => false
148
+ ) );
149
+ $post_types = array_merge( $post_types, array( 'post', 'page' ) );
150
+ $supported = array();
151
+ foreach ( $post_types as $post_type ) {
152
+ if ( post_type_supports( $post_type, 'wps_subtitle' ) )
153
+ $supported[] = $post_type;
154
+ }
155
+ return $supported;
156
+ }
157
+
158
+ /**
159
+ * Get the Subtitle
160
+ *
161
+ * @since 2.0
162
+ *
163
+ * @uses WPSubtitle::_get_post_meta()
164
+ * @uses apply_filters( 'wps_subtitle' )
165
+ *
166
+ * @param int|object $post Post ID or object.
167
+ * @return string The filtered subtitle meta value.
168
+ */
169
+ function get_the_subtitle( $post = 0 ) {
170
+ $post = get_post( $post );
171
+ $subtitle = WPSubtitle::_get_post_meta( $post );
172
+ return apply_filters( 'wps_subtitle', $subtitle, $post );
173
+ }
174
+
175
+ /**
176
+ * Get Post Meta
177
+ *
178
+ * @since 2.0
179
+ * @internal
180
+ *
181
+ * @param int|object $post Post ID or object.
182
+ * @return string The subtitle meta value.
183
+ */
184
+ function _get_post_meta( $id = 0 ) {
185
+ $post = get_post( $id );
186
+ return get_post_meta( $post->ID, 'wps_subtitle', true );
187
+ }
188
+
189
+ }
190
 
191
  /**
192
+ * Query DB and echo page/post subtitle, if any
193
+ *
194
+ * @uses WPSubtitle::_get_post_meta()
195
+ *
196
+ * @since 1.0
197
+ * @deprecated 2.0 Use get_the_subtitle() instead.
198
  */
199
+ function wps_get_the_subtitle() {
200
+ echo WPSubtitle::_get_post_meta();
 
 
 
 
 
 
 
 
 
 
201
  }
202
 
203
  /**
204
+ * Display XHTML for subtitle panel
205
+ *
206
+ * @since 1.0
207
+ * @deprecated 2.0 Legacy function.
208
  */
209
+ function wps_addPanelXHTML() {
 
 
 
210
  }
211
 
212
  /**
213
+ * Include CSS for subtitle panel
214
+ *
215
+ * @since 1.0
216
+ * @deprecated 2.0 Legacy function.
217
  */
218
+ function wps_addPanelCSS() {
 
219
  }
220
 
221
  /**
222
+ * Include XHTML for form inside panel
223
+ *
224
+ * @since 1.0
225
+ * @deprecated 2.0 Legacy function.
226
  */
227
+ function wps_showSubtitlePanel() {
 
228
  }
229
 
230
  /**
231
+ * For pre-2.5, include shell for panel
232
+ *
233
+ * @since 1.0
234
+ * @deprecated 2.0 Legacy function.
235
  */
236
+ function wps_showSubtitlePanelOld() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  }
238
 
239
  /**
240
+ * Store subtitle content in db as custom field
241
+ *
242
+ * @since 1.0
243
+ * @deprecated 2.0 Legacy function.
244
  */
245
+ function wps_saveSubtitle( $post_id ) {
 
 
 
 
 
 
 
246
  }
247
 
248
  /**
249
+ * The Subtitle
250
+ *
251
+ * @since 1.0
252
+ *
253
+ * @uses get_the_subtitle()
254
+ *
255
+ * @param string $before Before the subtitle.
256
+ * @param string $after After the subtitle.
257
+ * @param bool $echo Output if true, return if false.
258
+ * @return string The subtitle string.
259
  */
260
+ function the_subtitle( $before = '', $after = '', $echo = true ) {
261
+ return get_the_subtitle( 0, $before, $after, $echo );
 
 
 
 
 
262
  }
263
 
264
+ /**
265
+ * Get the Subtitle
266
+ *
267
+ * @since 1.0
268
+ *
269
+ * @uses WPSubtitle::get_the_subtitle()
270
+ *
271
+ * @param int|object $post Post ID or object.
272
+ * @param string $before Before the subtitle.
273
+ * @param string $after After the subtitle.
274
+ * @param bool $echo Output if true, return if false.
275
+ * @return string The subtitle string.
276
+ */
277
+ function get_the_subtitle( $post = 0, $before = '', $after = '', $echo = true ) {
278
+ $subtitle = WPSubtitle::get_the_subtitle( $post );
279
 
280
+ if ( ! empty( $subtitle ) ) {
281
+ $subtitle = $before . $subtitle . $after;
282
+ }
283
+
284
+ if ( ! $echo )
285
+ return $subtitle;
286
+ echo $subtitle;
287
+ }