May 26, 2009

How to preset text in the WordPress post editor

wordpress_logoIf you’re kind of a lazy person like I am, then here’s just the tutorial for you. Juston Tadlock has perfectly shown how to preset text in the WordPress editor. What does this mean? That you can modify your current WordPress theme’s functions.php file, and with the copying and pasting of a little code, you now have the ability for text to be shown at the bottom of your post, however much you want (with xhtml if you want), without actually putting it in the post editor.

Make note though, this text will show on all of the posts that you make after you modify the theme file, so it will not show up on any of your past posts that you have made.

How do you accomplish this hack? Well, open up your theme’s functions.php file, and copy and paste the following code:

add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
	$content = "This is some custom content I'm adding to the post editor because I hate re-typing it.";
	return $content;

After doing that, you can change the text to whatever you want, and if you want to, can edit it with some xhtml-markup. And that’s it!

Previous Post and Next Post

Try HostGator Webhosting for 1 cent for the 1st Month Click here and enter "wordpress"

Leave a reply

* means field is required.