Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a way to remove the post title? or atleast not require me to enter a post title. I have migrated from tumblr to wordpress and I didn't need to have a title with tumblr so I was wondering if I could do the same with wordpress?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Wordpress does not require entering post titles, at least not in the backend. You can leave that part of the form blank.

As far as your theme is concerned, that will depend on the theme author and whether they've considered someone not entering a title. The default twentyeleven theme handles it fine, linking to the post page using the date posted, but not all authors will be that thoughtful. If the theme you're using doesn't have an alternative, you could try editing the loop.

Depending on how the theme is set up, there might be only one loop, or several for different purposes. You're looking for loops related to archives, categories, tags, searches, and the home page. Often there will be a "default" loop that just gets all those values ("loop.php"). Look for code with title tags and <? the_title(); ?> inside them. Most will look something like this:

<h2 class="entry-title">
    <a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a>
</h2>

All things considered, you can usually just leave this alone. When there's not text to fill it out, the <h2> tag above just collapses and disappears. Trouble is, you need something else to link to the post page if this is the only link. The TwentyEleven theme provides just the thing. Add this function to your functions file:

function twentyeleven_posted_on() {
    printf( __( '<span class="sep">Posted on</span>
        <a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" 
        datetime="%3$s" pubdate>%4$s</time></a><span class="by-author"> 
        <span class="sep"> by </span> 
        <span class="author vcard">
        <a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a>
        </span></span>', 'twentyeleven' ),
    esc_url( get_permalink() ),
    esc_attr( get_the_time() ),
    esc_attr( get_the_date( 'c' ) ),
    esc_html( get_the_date() ),
    esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ),
    get_the_author()
    );
}

Then you can call it in the loop near where the header shows up:

<h2 class="entry-title">
    <a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a>
</h2>
<?php twentyeleven_posted_on() ?>

Hope this helps!

share|improve this answer
add comment

You could my plugin Fix Empty Titles. It creates a post title from the first 20 characters of the post body when the post is saved and the title is still empty.

The current code:

<?php # -*- coding: utf-8 -*-
/*
Plugin Name: Fix Empty Titles
Description: Replaces missing titles with the first characters from post body.
Version:     1.1
Required:    3.2
Author:      Thomas Scholz
Author URI:  http://toscho.de
License:     GPL

Based on an idea of Konstantin Kovshenin. See
http://kovshenin.com/2011/10/wordpress-posts-without-titles-in-rss-feeds-3621/
*/

add_action( 'save_post', 't5_fix_empty_title', 11, 2 );

/**
 * Fills an empty post title from the first words of the post.
 *
 * @param  int    $post_id      Post ID
 * @param  object $post         Post object
 * @return void
 */
function t5_fix_empty_title( $post_id, $post )
{
    if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
        or ! current_user_can( 'edit_post', $post_id )
        or ! empty ( $post->post_title )
        or empty ( $post->post_content )
        or wp_is_post_revision( $post )
    )
    { // Noting to do.
        return;
    }

    // Remove all tags and replace breaks whith white space.
    $no_tags = wp_strip_all_tags( $post->post_content, TRUE );

    // The post content contains just markup.
    if ( '' === $no_tags )
    {
        return;
    }

    $length = apply_filters( 't5_fix_empty_title_length', 20 );
    $words  = preg_split( "/\s+/", $no_tags, $length, PREG_SPLIT_NO_EMPTY );
    array_pop( $words );

    $title = implode( ' ', $words );
    // Add a no break space and an ellipsis at the end.
    $title = rtrim( $title, '.,!?…*' ) . ' …';

    wp_update_post( array ( 'ID' => $post_id, 'post_title' => $title ) );
}

I would not hide the title input field because then you had no easy way to change the title.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.