Automatically Add Text To The Wordpress TinyMCE Editor
I had a difficult time finding this useful bit of information so I thought I’d share. If you’d like to establish a default template, or include a particular set of data in each new wordpress post, this will do the trick. In the /wp-admin/ folder, open edit-form-advanced.php. Locate the following code around line 150 or 155:
<?php the_editor($post->post_content); ?>
Right above that line, add the following code:
<?php
if (empty($post->post_content)) {
$post->post_content = "whatever you want to appear by default here" ;
}
?>
The modified area should look similar to this:
</legend>
<?php
if (empty($post->post_content)) {
$post->post_content = "whatever you want to appear by default here" ;
}
?>
<?php the_editor($post->post_content); ?>
</fieldset>
<?php echo $form_pingback ?>
<?php echo $form_prevstatus ?>
Ta-da! Now log into your Wordpress admin panel and check out the write post tab. The data located between the quotation marks in $post->post_content should now appear in your Wordpress Tinymce editor every time.
Previous Post: Afraid to Blog Because You Don’t Know How to Write?
Next Post: What’s up? Shut up.



No comments yet.