ajaydsouza
7/22/2013 - 6:02 AM

#14: the_editor_content

#14: the_editor_content

<?php
/**
 * Inject a post template into the post editor
 *
 * @see _WP_Editors::editor(), wp_editor()
 *
 * @param string $content The editor content.
 *
 * @return string The filtered editor content.
 */
function wpdocs_post_editor_template( $content ) {
// Only return the filtered content if it's empty
	if ( empty( $content ) ) {
		$template  = 'The <code><a href="">NAME</a></code> filter allows you to do X.' . "\n\n";
		$template .= 'It is evaluated in <code><a href="">FUNCTION</a></code> in the <a href="">FILE</a> file.' . "\n\n";
		$template .= '<code>NAME</code> accepts # argument.' . "\n\n";
		$template .= 'Example:' . "\n\n";
		$template .= 'View the <a href="">code example on Gist</a>.';
		return $template;
	} else {
		return $content;
	}
}
add_filter( 'the_editor_content', 'wpdocs_post_editor_template' );