Changing the “Enter Title Here” Text in WordPress

WordPress

If you have created a custom post type for your WordPress site, you may have some specific information you want entered for the title.  For example, you may want to limit how long titles are, or you may want the person posting to include their name or other information in the title.  How can you convey this?  You can create an instruction list about what each of post on your site needs to include and email it to everyone, but there is a chance people will forget or will simply not read the email.  Fortunately, there is a way you can put specific instructions into your custom post type in the form of changing the text that appears in a blank box (usually it says something like “Enter Title Here”).  This WordPress tutorial will show you how.

Logging in and Finding Functions.php

First, you will need to login to your WordPress site and find the functions.php file.  It will be a part of the theme you are using, so go to the themes folder and find the one for your current theme.  Open the file for editing (you can use something basic like Notepad) and add in this code:

function custom_title_text ( $title ){

$screen = get_current_screen();

if  ( ‘type of custom post’ == $screen->post_type ) {

$title = ‘Enter custom text here’;

}

return $title;

}

add_filter( ‘enter_title_here’, custom_title_text’ );

You can change “type of custom post” to the name of your custom post type.  Then change the “Enter custom text here” to whatever you want the text to read.  For example, if your custom post type is for writing reviews of books, you might make the text read something such as “Enter book title and author as the post title.”  This way, everyone who is posting a review will be reminded that he or she need to make each post title start out with the title of the book being reviewed followed by the author.

Creating Functions

What does this code actually do?  It creates a function called custom_title_text that checks to see if the custom post type you’re using is “type of custom post” (in the example, it would check to see if the post type is named “Review”).  If it is, then it will place the custom text in the title box of the post.

Now if you create a new post of that post type, you should see your custom text instead of the “Enter title here” that automatically appears in the title post box.  Note that there is no character limit on your custom text message, but try to keep it short.  If you make it so long that it cuts off the end of the title box, it will be very difficult for users to read it.  The shorter and more direct you make it, the more useful it will be.

Limitations

Unfortunately, you cannot use this method to add custom instructions to other blanks.  However, the custom text you enter does not necessarily have to relate to the title post.  You can use this text as a way of reminding your users about anything.

Share it!Share on FacebookTweet about this on TwitterShare on Google+Email this to someone

Our Recommended Wordpress Web Hosting Provider

WordPress

WHC.CA
Get a 50% Discount by using our link.

WHC.ca

Reliable host, with excellent customer service and an easy one-click Wordpress installation. Our recommendation to host a Wordpress blog.

Leave a Reply

Your email address will not be published. Required fields are marked *