I am trying to modify the code for default content to display based on post type, but so far I have been unsuccesful. The base code is:
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
$content = "default content goes here....";
return $content;
}
My modifications include:
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
if ( 'sources' == get_post_type() ) {
$content = "Please insert an image of the document into this area. If there is no image, please descript the document in detail.";
return $content;
} elseif ( 'stories' == get_post_type() ) {
$content = "Please write your reminiscences, recollections, memories, anecdotes, and remembrances in this area.";
return $content;
} elseif ( 'pictures' == get_post_type() ) {
$content = "Please insert an image of a photograph into this area.";
return $content;
} else {
$content = "default!";
return $content;
};}
But this just isn’t working. I feel like I have missed the obvious.