WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/02/2014 10:52:31 PM (6 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-template.php

    r28903 r28963  
    146146            $private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ), $post );
    147147            $title = sprintf( $private_title_format, $title );
     148        } else if ( isset( $post->post_status ) && 'draft' == $post->post_status ) {
     149
     150            /**
     151             * Filter the text prepended to the post title of draft posts.
     152             *
     153             * The filter is only applied on the front end.
     154             *
     155             * @since 4.0.0
     156             *
     157             * @param string  $prepend Text displayed before the post title.
     158             *                         Default 'Draft: %s'.
     159             * @param WP_Post $post    Current post object.
     160             */
     161            $draft_title_format = apply_filters( 'draft_title_format', __( 'Draft: %s' ), $post );
     162            $title = sprintf( $draft_title_format, $title );
    148163        }
    149164    }
     
    538553            $classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id);
    539554            $classes[] = 'postid-' . $post_id;
     555            $classes[] = 'single-status-' . sanitize_html_class( $post->post_status );
    540556
    541557            // Post Format
Note: See TracChangeset for help on using the changeset viewer.