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.


Additional Posts Worth Reading

 

Comments »

No comments yet.

Name (required)


E-mail (required - never shown publicly)


URI - Web Site Address






Subscribe

Site of The Day

Sponsors

Categories

Recent Comments

  • Arthur: I can’t even be an Ebay affiliate. Tried various ways but still declined. Any help or suggestions?
  • chicago web design: I can’t imagine that these will last very long before Google banishes them all. But for now...
  • D.Ksyte: Anyone involved with cron job scheduling might find this resource useful. Cron Sandbox at HxPI is an...
  • FoNiX: “…decode md5″ is not possible, only bruteforce: generate hash and compare with original.
  • Z@$#: plz plz decript this hash for me any one….its really important…. 2CAD28C7C619F27DDE7B83C4999795BA
  • Joe: Thanks for writing this up. I tried the second method…however after the debian install the screen looks...
  • Scott: Was this issue ever resolved? I just started having a problem a couple weeks ago. I don’t do any kind of...
  • Prashant Patel: I had integrated Sp3 in Xp But finding one problem. In the Task Manager Process windows many services...
  • Ed: This looks like a real ‘leet’ linux command but it misses the point. Why would a hacker keep the name of...
  • Sudesh: My account was disabled but I followed their guideline and in one sec it was back on :) Here is the...

Top Commentators

Miscellaneous

  • Add to Technorati Favorites