Default Post Content

Download

Tired of typing in the same default content at the end of your post?  Use the same custom fields for each new post?  Make your WordPress install do it for you.

picture-3Post Content

Quickly and easily put together a block of default post text to be pulled up every time you go to write a new post.  The default content box uses the wordpress visual editor – so you can add images, embed video, and style your text just as you would for a normal post.  Save it, and voila – each new post gets the text.

Default Post MetaPost Meta

You’re covered on default post meta as well – use this if your theme uses a thumbnail for each post, and you need a default if you’ve got nothing to show,  or if you store a little extra information in the postmeta for each post.

Give it a try, and let me know what you think.  If you have problems, let me know in the comments section, or via email:  peter [at] apartmentonesix [dot] com.

5 Comments

  1. This is exactly what I was looking for! I wanted a default “thumbnail” custom field image url to appear by default for all new posts which I could overwrite when needed. Thank you!

  2. Hi, this plugin is truly great, but i’ve been having this issue, whenever i click “publish” it goes to a blank page with the following:

    Warning: Invalid argument supplied for foreach() in /home/tatayac/public_html/wp-content/plugins/default-post-content/default_post_content.php on line 53

    Warning: Cannot modify header information – headers already sent by (output started at /home/tatayac/public_html/wp-content/plugins/default-post-content/default_post_content.php:53) in /home/tatayac/public_html/wp-includes/pluggable.php on line 865

    I hit refresh, goes back to the editor and my post is published, but it is kind of annoying because it happens every time. Is there a way to fix this? I’m on WP 2.8.6

    • Sorry about that – here’s the fix:

      In default_post_content.php, find this block on line 53:


      foreach($default_meta as $meta){
      update_post_meta($id, $meta['meta_key'], $meta['meta_value']);
      }

      Replace that with this:

      if(is_array($default_meta)){
      foreach($default_meta as $meta){
      update_post_meta($id, $meta['meta_key'], $meta['meta_value']);
      }
      }

      Let me know if that doesnt work. Thanks!

  3. Hi Peter, thanks for your quick reply, edited the code and the problem did got fixed, but then the plugin began to fail, i.e. whenever i hit “save” it just doesn’t. Tried deactivating and replacing with a fresh install of the (corrected) plugin but the problem persisted, also when i deactivactivate i get a similar warning for line 176, i’m no programmer but took a shot at replacing:

    foreach($defaultmeta as $meta){
    delete_post_meta(0, $meta['meta_key']);
    }

    with

    if(is_array($default_meta)){
    foreach($default_meta as $meta){
    update_post_meta($id, $meta['meta_key']);
    }
    }

    and actually fixed the warning (yay), but the plugin still doesn’t save my default content.

    Is really weird because i have the exact same install on a test site with the same plugins and everything and i don’t get any of this errors, so i’m still puzzled. Since having it working was kind of urgent for my client i ended up using a different not-so-elegant solution but does the job.

    I’ll look into it more thoroughly this weekend.

Leave a Reply