3 WordPress Title Box Hacks

3 WordPress Title Box Hacks

These 3 title box snippets (all tested with the Twenty Eleven theme’s functions.php on WP 3.4.1) will let you customize your “New Page” or “New Post” title areas.

Change default “Enter title here” text for Posts and Pages

Before: Default Add New Post title box

{code type=php}function title_text_input( $title ){
return $title = ‘What are you feeling?‘;
add_filter( ‘enter_title_here’, ‘title_text_input’ );
Source: WPSnipp.com

After: New Post Title text

It works for both Posts and Pages.

Change default “Enter title here” text for Custom Post Type Posts

{code type=php}function change_default_title( $title ){
$screen = get_current_screen();
if  ( ‘pricing_table_post_type‘ == $screen->post_type ) {
$title = ‘Enter Pricing CPT Title‘;
return $title;
add_filter( ‘enter_title_here’, ‘change_default_title’ );
Source: WPSnipp.com

After: New Post Custom Post Type Title text

You can find the custom post type name in the URL of its options or Add New page.

For example: /wp-admin/edit.php?post_type=pricing_table_post_type

Change Post, Page, and CPT titles to WYSIWYG (add TinyMCE Editor)

This will override both of the customizations above, yes, even for Pages and Custom Post Types.

{code type=php}function tinymce_title_js(){ ?>
<script type=”text/javascript”>
jQuery(document).ready( tinymce_title );
function tinymce_title() {
tinyMCE.execCommand(“mceAddControl”, false, “title”);
<?php }
add_action( ‘admin_head-post.php’, ‘tinymce_title_js’);
add_action( ‘admin_head-post-new.php’, ‘tinymce_title_js’);
function tinymce_title_css(){ ?>
<style type=’text/css’>
#titlewrap{border:solid 1px #e5e5e5 !important;}
#title_ifr{height:50px !important;}
<?php }
add_action( ‘admin_head-post.php’, ‘tinymce_title_css’);
add_action( ‘admin_head-post-new.php’, ‘tinymce_title_css’);

Source: WPSnipp.com

After: WYSIWYG Post Title Input
After: WYSIWYG Post Title Output

The End

I hope you enjoyed these 3 snippets. You might also be interested in putting them into your own plugin instead of functions.php, adding a subtitle to post titles, or even hiding some of your Page and Post titles from displaying on your theme.