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
1
2
3
4
function title_text_input( $title ){
return $title = '<strong>What are you feeling?</strong>';
}
add_filter( 'enter_title_here', 'title_text_input' );

Source: WPSnipp.com

After: New Post Title text

It works for both Posts and Pages.

Featured Plugin - WordPress Facebook Plugin

Would you like to add Facebook comments, registration, 'Like' buttons and autoposting to your WP site? Well, The Ultimate Facebook plugin has got that all covered!
Find out more

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

1
2
3
4
5
6
7
8
function change_default_title( $title ){
$screen = get_current_screen();
if  ( '<strong>pricing_table_post_type</strong>' == $screen->post_type ) {
$title = '<strong>Enter Pricing CPT Title</strong>';
}
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

Featured Plugin - WordPress Ecommerce Shopping Cart Plugin

Out of all the WordPress ecommerce plugins available, MarketPress has got to be the winner - easy to configure, powerful functionality, multiple gateways and more. A simply brilliant plugin!
Find out more

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function tinymce_title_js(){ ?>
<script type="text/javascript">
jQuery(document).ready( tinymce_title );
function tinymce_title() {
jQuery("#title").addClass("mceEditor");
tinyMCE.execCommand("mceAddControl", false, "title");
}
</script>
<?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;}
tr.mceLast{display:none;}
#title_ifr{height:50px !important;}
</style>
<?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.

Participate