Exemplo n.º 1
0
 /**
  * Verify Post Edit Capability
  *
  * @since  2.0.1
  * @internal
  *
  * @param   int  $post_id  Post ID.
  * @return  bool
  */
 static function _verify_post_edit_capability($post_id)
 {
     $post_types_obj = (array) get_post_types(array('_builtin' => false), 'objects');
     // Check supported post type
     if (isset($_POST['post_type']) && WPSubtitle::is_supported_post_type($_POST['post_type'])) {
         if ('page' == $_POST['post_type'] && current_user_can('edit_page', $post_id)) {
             return true;
         } elseif ('post' == $_POST['post_type'] && current_user_can('edit_post', $post_id)) {
             return true;
         } elseif (current_user_can($post_types_obj[$_POST['post_type']]->cap->edit_post, $post_id)) {
             return true;
         }
     }
     return false;
 }
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 '';
 }