Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2. /**
  3. * Inject a post template into the post editor
  4. *
  5. * @see _WP_Editors::editor(), wp_editor()
  6. *
  7. * @param string $content The editor content.
  8. *
  9. * @return string The filtered editor content.
  10. */
  11. function wpdocs_post_editor_template( $content ) {
  12. // Only return the filtered content if it's empty
  13. if ( empty( $content ) ) {
  14. $template = 'The <code><a href="">NAME</a></code> filter allows you to do X.' . "\n\n";
  15. $template .= 'It is evaluated in <code><a href="">FUNCTION</a></code> in the <a href="">FILE</a> file.' . "\n\n";
  16. $template .= '<code>NAME</code> accepts # argument.' . "\n\n";
  17. $template .= 'Example:' . "\n\n";
  18. $template .= 'View the <a href="">code example on Gist</a>.';
  19. return $template;
  20. } else {
  21. return $content;
  22. }
  23. }
  24. add_filter( 'the_editor_content', 'wpdocs_post_editor_template' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement