This snippet of PHP sets a blank post title using the current date and time. Very useful with status type posts. This code is based on work by Chris Reed.
//Remove Post Title in Blog for Status Posts
add_filter( 'post_class', 'crt_remove_status_post_titles' );
function crt_remove_status_post_titles( $classes ) {
if ( has_post_format( 'status' ) ) {
$classes[] = 'hidetitle';
}
return $classes;
}
?
// Change the Post Title to the Current Date
add_filter( 'wp_insert_post_data', 'crt_update_blank_title' );
function crt_update_blank_title( $data ) {
$title = $data['post_title'];
$post_type = $data['post_type'];
if ( empty( $title ) && ( $post_type == 'post' ) ) {
$timezone = get_option('timezone_string');
date_default_timezone_set( $timezone );
$title = date( 'Y-m-d H.i.s' );
$data['post_title'] = $title;
}
return $data;
}