Exemplo n.º 1
0
 /**
  * Add Subtitle Field
  *
  * @since  2.2
  * @internal
  *
  * @uses  WPSubtitle::_get_post_meta()
  * @uses  apply_filters( 'wps_subtitle_field_description' )
  */
 static function _add_subtitle_field()
 {
     global $post;
     echo '<input type="hidden" name="wps_noncename" id="wps_noncename" value="' . wp_create_nonce('wp-subtitle') . '" />';
     echo '<div id="subtitlediv" class="top">';
     echo '<div id="subtitlewrap">';
     echo '<input type="text" id="wpsubtitle" name="wps_subtitle" value="' . esc_attr(WPSubtitle::_get_post_meta($post->ID)) . '" autocomplete="off" placeholder="' . esc_attr(apply_filters('wps_subtitle_field_placeholder', __('Enter subtitle here', WPSubtitle::TEXTDOMAIN))) . '" />';
     echo '</div>';
     // Description
     $description = apply_filters('wps_subtitle_field_description', '', $post);
     if (!empty($description)) {
         echo '<div id="subtitledescription">' . $description . '</div>';
     }
     echo '</div>';
 }
Exemplo n.º 2
0
 /**
  * Get the Subtitle
  *
  * @since  2.0
  *
  * @uses  WPSubtitle::_get_post_meta()
  * @uses  apply_filters( 'wps_subtitle' )
  *
  * @param   int|object  $post  Post ID or object.
  * @return  string             The filtered subtitle meta value.
  */
 static function get_the_subtitle($post = 0)
 {
     $post = get_post($post);
     if ($post && WPSubtitle::is_supported_post_type($post->post_type)) {
         $subtitle = WPSubtitle::_get_post_meta($post);
         return apply_filters('wps_subtitle', $subtitle, $post);
     }
     return '';
 }