I’m making a course plugin for a university in England. I’m looking to put some default placeholder text in the main post content area, on the admin side. Its the rich text editor I want it to go behind. I might just be typing the wrong words, but can’t find it here… preferably a non js thing…
Basically something like ‘Use this area to write an introduction to the course…’.
Thanks
You can change ‘post’ to which ever post type you want to apply the default content to.
add_filter( 'default_content', 'wpse57907_default_content', 10, 2 );
function wpse57907_default_content( $content, $post ) {
if ( 'post' == $post->post_type )
$content="Use this area to write an introduction to the course...";
return $content;
}
Edit
I’m not sure you can add placeholder text to tinymce editors. The followng method will add a placeholder to the underlying textarea (you can view it on the ‘html’, soon to be ‘text’ tab):
add_filter('the_editor','wpse57907_add_placeholder');
function wpse57907_add_placeholder( $html ){
$html = preg_replace('/<textarea/', '<textarea placeholder="my place holder text" ', $html);
return $html;
}
But this does not appear on the visual editor (as I say, I’m not sure placeholders work with TinyMCE – if someone knows how, please comment.).