Prepend "Draft:" to draft post titles when previewing on the front end, and add a "single-status-$status" class to the body classes for all post statuses. Fixes #28006. Props hlashbrooke

Built from https://develop.svn.wordpress.org/trunk@28963


git-svn-id: http://core.svn.wordpress.org/trunk@28756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2014-07-02 22:53:14 +00:00
parent 428a83259e
commit b8bd46c406
1 changed files with 16 additions and 0 deletions

View File

@ -145,6 +145,21 @@ function get_the_title( $post = 0 ) {
*/
$private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ), $post );
$title = sprintf( $private_title_format, $title );
} else if ( isset( $post->post_status ) && 'draft' == $post->post_status ) {
/**
* Filter the text prepended to the post title of draft posts.
*
* The filter is only applied on the front end.
*
* @since 4.0.0
*
* @param string $prepend Text displayed before the post title.
* Default 'Draft: %s'.
* @param WP_Post $post Current post object.
*/
$draft_title_format = apply_filters( 'draft_title_format', __( 'Draft: %s' ), $post );
$title = sprintf( $draft_title_format, $title );
}
}
@ -537,6 +552,7 @@ function get_body_class( $class = '' ) {
if ( isset( $post->post_type ) ) {
$classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id);
$classes[] = 'postid-' . $post_id;
$classes[] = 'single-status-' . sanitize_html_class( $post->post_status );
// Post Format
if ( post_type_supports( $post->post_type, 'post-formats' ) ) {