Last active
December 20, 2015 01:49
-
-
Save WerdsWords/6051602 to your computer and use it in GitHub Desktop.
#14: the_editor_content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://fotd.werdswords.com/the_editor_content/