• 14 Sep 2008 /  This Blog

    By default, Wordpress make a private or protected post title look like this:

    (Private) MyBlogEntryTitle

    I’ve hacked it to look like this:

    MyBlogEntryTitle (Private)

    Really simple, really.

    The hack is to wp-includes/post-template.php, where I change the get_the_title() function to read:

    function get_the_title( $id = 0 ) {
            $post = &get_post($id);
    
            $title = $post->post_title;
    
            if ( !is_admin() ) {
                    // 2008-08-31, RS, moved Protected and Private text to end of title
                    if ( !empty($post->post_password) )
                            $title = sprintf(__('%s (Protected)'), $title);
                    else if ( isset($post->post_status) && 'private' == $post->post_status )
                            $title = sprintf(__('%s (Private)'), $title);
            }
            return apply_filters( 'the_title', $title );
    }

    Yeah, yeah, I know the curly braces should be on their own line but I’m not fixing Wordpress’ code formatting, just its functionality.

    Mostly just documenting this so I don’t forget, ’specially as I need to do an upgrade of this blog to 3.6.2.  A little inline documentation goes a long way, though.

    Tags: , ,