From a5ea708b60aabe9970cc6d3ff0a25c77c3a954a6 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Tue, 29 Apr 2014 11:08:12 +1000 Subject: [PATCH] Emulate core function for draft or post title --- includes/sp-core-functions.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/includes/sp-core-functions.php b/includes/sp-core-functions.php index bd58ffb8..ee25e5b0 100644 --- a/includes/sp-core-functions.php +++ b/includes/sp-core-functions.php @@ -674,12 +674,7 @@ if ( !function_exists( 'sp_post_checklist' ) ) {
  • ', sizeof( $parents ) ); ?> ', sizeof( $parents ) ); ?>
  • @@ -693,6 +688,26 @@ if ( !function_exists( 'sp_post_checklist' ) ) { } } + +/** + * Get the post title. + * + * The post title is fetched and if it is blank then a default string is + * returned. + * + * @since 2.7.0 + * @param mixed $post Post id or object. If not supplied the global $post is used. + * @return string The post title if set + */ +if ( !function_exists( 'sp_draft_or_post_title' ) ) { + function sp_draft_or_post_title( $post = 0 ) { + $title = get_the_title( $post ); + if ( empty( $title ) ) + $title = __( '(no title)', 'sportspress' ); + return $title; + } +} + if ( !function_exists( 'sp_get_var_labels' ) ) { function sp_get_var_labels( $post_type ) { $args = array(