Simple Post Template WordPress Plugin

Many bloggers use a similar format for many or all of their posts. WordPress provides no native way to pre-fill your new posts with such a template. This plugin provides the simplest solution to this problem. It takes 5 minutes to install and setup. The template allows you to define a title and a body and support HTML and even PHP.  There’s no easier solution.

Version 1.1:

  • You can now specify a default excerpt in your template (in case you wanted to)
  • Rewrote backend to use standard supported methods and less hacking.
  • Completely fixed issue with template content breaking “Insert Template” button. Contents is now encoded to HEX and decoded upon insert.
  • Removed upgrade option for legacy versions. I never received any feedback on this feature and suspect it was rarely used, if used at all.
  • Redesigned admin panel for aesthetic and informational purposes. Now includes PHP examples and considerations.

Version 1.0.0.1:

  • Fixed security issue. Now only Administrators can access admin pages.

Version 1.0:

  • Moved all settings to administration pages under Settings -> Simple Post Template.
  • Moved content of template and title to WordPress options.
  • Provided upgrade mechanism to convert old templates to the new format. (May not work for all applications. Some may work but may be more complex than neccessary.)
  • Added optional “Insert Template” button to new post page. You can now determine from the settings page whether or not the template will be automatically applied to all new posts.
  • Plugin is now upgrade proof. Settings are stored using WordPress’s setting functions.
  • Various other improvements were made to address inefficiencies in the first version.

Version 0.1:

  • Original release.
    New administration panel.

    New administration panel.

    New button (only appears when auto fill is deselected in admin panel)

    New button (only appears when auto fill is deselected in admin panel)

    Installation

    1. Upload the directory “simple-post-template” to the `/wp-content/plugins/` directory
    2. Activate the plugin through the ‘Plugins’ menu in WordPress
    3. Go to Settings -> Simple Post Template and enter your desired title and body for new posts. (Feel free to use any combination of HTML and PHP.)
    4. If you select “Auto fill new posts with this template.” all new posts will be created with your template. If you uncheck this, the new posts screen will have a new sidebar widget with a button allowing you to apply the template.
    5. There’s nothing else to do. Enjoy! (unless you are upgrading, in which case, see below)

    ATTENTION UPGRADERS FROM VERSION 0.1, READ THIS:
    If you use automatic upgrade from the WordPress plugin screen, WordPress will most likely delete your current templates. Period. I didn’t realize this until after I wrote and uploaded these instructions. If you wish to use the described upgrade feature (that I apparently spent way too much time on!) simply copy your template.php and title.php files to another location before upgrading automatically, OR upgrade the old fashioned way.

    Version 1.0 provides vast improvements to the way templates are stored and executed. Consequently, I no longer use template.php and title.php to create templates. The template is now stored in the WordPress database and PHP is processed at runtime using eval(). To assist users of old version, the admin screen provides an Upgrade button for those who still have the old flat files. The upgrade tasks is not fool proof. The original templates were stored in a string in two flat files. I have attempted to copy over that string and encapsulate it in a PHP echo which should keep most HTML and PHP working well. However, the result is likely to be more complicated than necessary…

    For example, if you original template had this:
    $template = “Hi this is some text and whoops!”.$some_php_variable.” What was that??”;

    Than your new template will look something like:
    <?PHP echo “Hi this is some text and whoops!”.$some_php_variable.” What was that??”; ?>

    Quite obviously, this can be done different/better with the new system:
    Hi this is some text and whoops! <?PHP echo $some_php_variable; ?> What was that??

    The latter example is obviously much better and will make templates *much* easier to do for first time users. This should be the last time I make large changes to the way templates are done. Because of this, I’m comfortable releasing it at version 1.0 instead of 0.2 or some derivative.

    So, once again, the upgrade mechanism is provided as a curteousy. I’ve tried to make it as easy as possible to upgrade, but I encourage to fine tune the result of this upgrade and make it your own.

    Frequently Asked Questions

    • Can you add multiple templates that are selectable from a dropdown?
      I intend to do this eventually.
    • Can feature x be added?
      Probably! E-mail me: webmaster[at]clifgriffin.com

    Download it now…
    Simple Post Template 1.1 for WordPress 3.0.4

    • http://notextraordinary.blogspot.com Shanna

      clifton all this interwebs stuff is confusing. please post something interesting

    • http://clifgriffin.com clifgriffin

      Don’t hate!

    • Pingback: WordPress Plugins Releases for 10/30 | bloground.ro - Blogging resources, WordPress themes and plugins for your development

    • Pingback: WordPress Plugins Releases for 10/30 | BlogBroker24-7

    • http://www.configuracionvisual.com dlv

      it’s nice, thanks for work on things like this..it’s hard to do a plugin

      good bye
      adeux

    • http://clifgriffin.com clifgriffin

      You’re welcome. Glad you like it!

    • Pingback: /++//++//++//++//++//++/ » Blog Archive

    • Pingback: WordPress Plugins Releases for 10/30 | PATRONIT.NET

    • Pingback: Leonaut.com

    • Pablo DiCiacco

      There needs to be a standard adopted for all WP plugin offerings. That standard should be all plugins should be required to show working examples of the plugin on the developer site. Included should be what version of WP is being used on the site.

      Also, please urge WP to rework the search function on their extend page. The search as it functions now is completely useless.

      I will not download, or recommend your plugin because you cannot show working examples.

    • http://clifgriffin.com clifgriffin

      Pablo,
      Your concerns would be much better directed at WordPress.

      This plugin works entirely within the administrative portion of WordPress. It also requires you to have FTP access in its current form.

      I’m not going to setup either of those simply to satisfy one person that this plugin is legit.

      If you can’t take my word (and the word of others who have tried the plugin), I guess just don’t use it?

      Clif

    • http://www.flickr.com/photos/audiostein audiostein

      Thanks! Just what i needed.

    • http://techpp.com Raju

      I had to read the post thrice to understand the feature:0 But I did manage to understand the third time, so not too bad eh?!

      One typo in Installation instruction I guess – “Upload the directory “Simple-LDAP-Login” to the `/wp-content/plugins/` directory”

      Why Simple-LDAP-Login?

      • http://clifgriffin.com clifgriffin

        Ugghhhhh. I copied pasted from another plugin to save time and forgot to change that reference. It should be simple-post-template.

        Sorry!

        • http://techpp.com Raju

          happens :D
          looking forward for more useful stuff from you :) Subscribed!

    • http://www.jonesfamily.us Ron Jones

      Thanks very much!

      This is a helpful little plugin that just fits what I needed. I’m using a tracking program called Xtreme Conversions, that requires a string of php code at the top of each post.

      Worked like a charm once I figured out how to escape all the dollar signs ;)

      I’d like to tweak it to work on pages as well. and (since I’m being lazy) it might be helpful to choose to add the code to a post/page by pressing a button in the editor (as opposed to it appearing by default).

      Nonetheless, I do appreciate it.

      Ron Jones
      Mt. Juliet, TN

      • http://clifgriffin.com clifgriffin

        Thanks for the suggestions, those are definite possibilities. I’m unconvinced my template files are the best approach so I plan on doing some revisions eventually.

    • Pingback: How to give blog posts a common structure - the easy way — KnowIT

    • http://www.phatbrush.com rohin

      is it possible to pre-fill custom fields as well ?

    • http://phatbrush.com/ rohin

      still waiting on that answer about custom-feilds cliff !

      • http://clifgriffin.com clifgriffin

        Hey, sorry! I missed this somehow. :)

        It isn’t possible in the existing version, but I’ll investigate it for future versions. (No specific timeline right now for the next release…just depends on what features I come up with and how long they take to implement and how much time I can dedicate to the project.)

        How important is this for your usage? What is the application you have in mind?

    • Pingback: Simple Post Template Wordpress Plugin Clifton Griffin | Uniform Stores

    • http://phatbrush.com Rohin

      If you added this , You would save me about 15-20 minutes a day.

      I post things in batches and manually having to customize the custom fields really sucks hah.

      (Take a look at my site you’ll see what I’m talking about when you see the front page , Each pic is a custom feild)

    • Fieke Bazelmans

      Hi,

      is it possible to create more than 1 Post Template? I actually need two…one for the agenda of our meetings and one for the notes of those meetings.

      Thanks!

      Fieke

      • http://clifgriffin.com Clifton Griffin

        Not in the current version, sorry.

    • http://www.howtomakemoneyby.com Ellery

      What if I want to add some text in anyplace inside the post? Like what Adsense Now does?

    • http://www.precaged.org/ knockoff designer bags

      Best link for you – replica designer purses

    • http://www.bsnlinfo.co.in Selvam

      Its really cool wordpress plugin and avoid lot of code updates in post templates. Great work. keep it up.

    • http://www.shannonkleiner.com Shannon

      Is it possible to add an option through which you could choose a template to be used by a specific user? I would like to create multiple Simple Post Templates so that one user’s template is different from another’s.

      • http://gate21.net lawvol

        I agree with Shannon. This plugin has the best interface and function of any of the template plugins I’ve seen. If it ONLY had the ability to support multiple templates I would deploy it in a minute (I am needing it to help provide templates to my multiple authors who aren’t HTML saavy).

        If it could do that, it would be awesome…

        • http://clifgriffin.com Clifton Griffin

          Hi Lawvol,
          It seems I missed Shannon’s comment before.

          Can you describe how you would like this to work from an administration/practical standpoint?

          ie, how would you like to manage these multiple templates?

          • http://gate21.net lawvol

            Well, I guess I would convert the button on the Edit Post screen into a dropdown menu to allow selection of templates.

            Then I suppose you could add a “manage template” admin screen which allows you to see and edit the templates available.

            Here is a link to some screenshots from another template plugin which sort of represent what I was thinking: WP Plugins: Post Templates > Screenshots

            I suppose the biggest thing is just to permit the creation of multiple templates, and the ability to select those templates from within the edit post window.

            Thanks for making this available!

    • http://www.spongebob-coloringpages.com Nicole

      Thanks for this plugin.
      I added the text that I want in the template but I could not work out how to edit it all all.
      For e.g. I would like to change the size and color of the headings. Is this possible?
      Thanks again!
      Nicole

    • aos

      I love this plugin a LOT. I’ve been copy-pasting the same info for countless posts, now I finally have it set in stone on my posts.

      Do you think something like this is possible for post excerpts too? :) I’d do anything for a script like that. Just wondering haha :)

      Great job on this script. I really appreciate it!

    • http://www.inkmusings.com Gary

      Love what this plugin can do, but having a difficult time passing php code from template to new post. This:
      [wp_cart: ?php the_title();? :price:?php the_excerpt(); ?:end]
      becomes this:
      [wp_cart::price::end]
      (left out the around the php for this comment or it wouldn’t show up).

      Is this expected behavior? Or should I be able to set up php in the template and pass to the posts? Thx.

      • http://www.inkmusings.com Gary

        PS: I forgot to mention I have the plugin that allows PHP in posts.

      • http://clifgriffin.com Clifton Griffin

        Hi Gary, I thought I posted this yesterday but something must have gone wrong. Here is my response:

        Using php in a post might complicate things. The magic of my plugin lies in this line of code:

        eval(‘?>’.stripslashes(get_option(“spt_template”)));

        I execute any php in the template before I place it in the new post. To circumvent this, I imagine you need to escape any php you put in using whatever escape sequences you would need to put php in a php string.

        I think this may result in just the text of your php in the template on execute which should allow your other plugin to process it.

        I haven’t tested it but I think it should be possible.

        Let me know if you have problems.

    • http://hosting.websycon.com/ web hosting

      Hey, you must see it – VDS hosting

    • http://www.порно-онлайн.su порно ролики

      Текст реально порадовал. Автору респект. В поддержку темы тоже делюсь тем, что близко мне – http://www.порно-онлайн.su, Заходите – не пожалеете

    • http://lamonte-bird.com Richard

      Hi. Thanks for the great plugin. Like others who have commented, it could save me a lot of time. Unfortunately, it seems to be incompatible with Advanced Excerpt, using WP 2.8.6. When I had both installed, Advanced Excerpt would not display the excerpt for any post that was made using the Simple Post Template. Sadly, I had to choose one of these plugins, and I really need custom excerpts. Sniff, sniff. :(

    • Suzanne

      Hey Clifton thanks for this handy plug-in. I installed it on my sister’s business site but I wanted to ask about an odd behavior I noticed.

      The excerpt entry field is being auto-populated by four spaces when you save your settings. Upon subsequent saves, it adds a space to the four that were save the first time. Every time you save your settings, it adds another space.

      I didn’t notice this at all until I was investigating why posts to Facebook were showing no description text. Facebook pulls first from the meta description if there is one and when I looked at the HTML for the pages of the site, the meta descriptions were full of spaces :-O

      I tracked it back to the fact that Simple Post Template was inserting those spaces into the excerpt which some themes use to populate the meta descriptions.

      Wasn’t sure if this was formally a bug so I figured I’d post the note here first.

      Cheers.

      • http://clifgriffin.com Clifton Griffin

        Suzanne,
        Thanks for your comment. I have not perused the comments on this post in forever. I apologize.

        Another user has posted a solution to this:
        “All you have to do is remove the spaces before on line 112 and you’re done. Personally I’ve put straight after the ?> on line 111.”

        I will include this solution in a future version. (Not sure when that will be released, but hopefully in the next few weeks.)

    • Irwin

      Great plug in.

      Is it possible to add multiple post templates?

      Thanks in advance.
      is

      • http://clifgriffin.com Clifton Griffin

        I have no plans to implement such a thing at the moment.

        I have less time to devote to projects like this. Next time I release a new version, I will consider implementing such a system.

    • Pingback: Top 10 Most Useful Wordpress Plugins (for Webmasters) | Webmaster Index

    • http://www.indolering.com Zach Lym

      I am seconding the multiple templates option!

      Thanks,
      -Zach

    • http://www.al-rasid.com Mouad

      Thanx for the nice plugin, but it sadly doesnt support Arabic. Saving the template went ok, but when inserting it by hitting the “insert” button, it pastes a mixture of ambigious sumbols, not Arabic.

      Meanwhile, I created a TEMPLATE draft post that I will simply enter and copy its content to the new post.. this is even simpler than using the plugin :D

      but thanx in any case..

    • http://www.justinslewis.com Justin Lewis

      Excellent plugin! I also think multiple templates would be a nice option.

    • http://marketingwizdom.com Robert Clay

      This works really well … as far as it goes. Could I add my voice to the others who are requesting a multiple templates option, in rather the same way that forms builders usually allow the building of multiple different forms. Thanks for what you’ve done so far.

    • marikamitsos

      Hi Clifton,
      As everybody else stated as well: Great plugin. Thank you so much.
      I have an issue though. There is still some kind of a glitch with the sidebar widget. I recently installed the plugin in a blog that uses the greek language. So there are greek characters in the template.
      When I select “Auto fill new posts with this template.” all new posts look as they should, utf-8 encoded.
      Now if I uncheck it and save, although the template looks fine, when I click on the widget button it brings the data corrupted. Meaning not in utf-8 encoding.
      Could you please look into it? I guess it should be a minor fix.
      I use wordpress 2.9, php 5.2.11, MySQL 5.1.45-log
      Thanx again, marikamitsos

      • http://clifgriffin.com Clifton Griffin

        There seems to be an issue with any language that isn’t UTF-8 encoded. I’ll have to look into a solution for this in the next release, no promises on timeline though. (I know I sound like a broken record.)

        • marikamitsos

          Hmmm. The problem must be elsewhere. You see they are greek characters BUT the encoding of the whole site as well all the tables are utf-8 encoded.
          I know I sound like a broken record as well, but pretty please look into it. This is a unique plugin that you created ;-)

    • Benjamin

      I’ve made additions to plugin which allow for connecting through an LDAP proxy with an intermediate user name (required in some environments). Is there a way to get this code to you for possible inclusion in the next version of Simple LDAP?

      • Benjamin

        Oops, should have posted that to the Simple LDAP page, not the Simple POST Template page. Sorry about that, I’ll re-post.

    • http://www.cinnamonbearlodge.net Jason

      re: blank excerpts.

      It was mentioned further up that excerpts aren’t being shown because of four spaces that are being saved in the simple post template. This is caused by line 111 of simple-post-template-admin.php.

      All you have to do is remove the spaces before </textarea> on line 112 and you’re done. Personally I’ve put </textarea> straight after the ?> on line 111.

      If you are not confident editing this file, you can always manually remove the spaces from the post excerpt after the simple post template has been applied. Although this is an extra step, it has the same effect.

      Hope that helps

      Jason

      • http://clifgriffin.com Clifton Griffin

        Thanks for posting this solution.

        I will implement this fix in the next version.

    • Ryan

      This is exactly what I need, with one expection. I need a diffrenr prefill depending on what the post is about. So what I really need is a plugin like this that can let you specify several templates then when making a new post I could choose which one to use from a drop down.
      Do you by chance know of such a plugin or would this be a feature you would be willing to add here shortly?

      Also another idea (not an immediate requirement for me) is to preselect categories. Seems kinda strange to use with just one templete but if you have several template options, each one would be used for a diffrent type of post and would likley be categorized in a standard way.

    • norton

      I agree. Support for different post types would absolutely make sense, since WordPress 3.0

      • http://clifgriffin.com Clifton Griffin

        I will investigate such a thing. I understand post types, but I’m unsure of how these are exposed for plugins.

        I’ll consider putting it into a future version if it is easy enough. (Don’t have a lot of time to work on this type of project at the moment.)

    • Leo

      Hi,

      Im also having problems because my template have PHP and eval code execute my code when I load the template, I tried a bunch of changes to fix this but I wasnt succeeded … can you help me please ? Just load content as typed not eval PHP ?

      Thanks in advance !

      • http://clifgriffin.com Clifton Griffin

        The issue is that the plugin already uses an eval statement to render the PHP in the template. Adding another eval means you have an eval in an eval. I suspect that is not allowed and no of know way to fix it at the moment.

        Sorry!
        Clif

    • http://www.studentsinsport.com studentsinsport.com

      i have used the simple template to try to design a template for adding colleges to my site as individual posts.
      page http://www.studentsinsport.com/?p=1539 is an example.

      how do i remove the lines from the template and make the layout look better?

      i need to fit the logo and the video in on the right but am struggling….
      thanks

    • Pingback: パソコン教室 オキ楽 » WordPressについて現時点でまとめておこうっと

    • http://- Maxcim

      Multiple post templates would be a great feature!
      With a dropdown menu to choose one.

    • http://www.imaginethat.uk.net Keith Beesley

      I have to say “Simple is Best” I love your plugin – it just works so much better than the sophisticated plugins which require php alterations and single.php duplications which is ok if your theme uses the single.php file which mine DOESN’T. So thanks.

      One question will you ever be able to select from a drop-down menu within a post to choose different templates for different post this would be utopia. Thanks again Keith.

      • Anonymous

        Yes!

        I intend to implement this relatively shortly. I haven’t had time to update this plugin in a long time, but this is coming sometime in the next month or two.

    • johnn baptise

      WordPress is software on the web, you can use to create a beautiful website or blog. I would like to say that WordPress is free and priceless at the same time.

      joomla video chat

    • fentory ward

      Word Press is best to the blog comment and create a design and make site and use in the SEO and other marketing value increase.

      Buy Adult link

    • http://www.octav.name Octav

      if you change WP_DEBUG to TRUE you get a double error in wp-admin:

      Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /wp-includes/functions.php on line 3466

      In order to fix this, you need to change spt_admin_actions function’s content from:

      add_options_page ( “Simple Post Template”, “Simple Post Template”, 10, “simple-post-template”, “spt_menu” );

      into:

      add_options_page ( “Simple Post Template”, “Simple Post Template”, “edit_dashboard”, “simple-post-template”, “spt_menu” );

      Thanks!

      • Anonymous

        Implemented, thanks.  I originally wrote this when I was still quite a novice so some things like this slipped through.  

      • The Review Wire

        Thank you! Thank you! 

    • Google

      I’ve been getting blank excerpts – turns out that on the config page for Simple Post Template, the ‘Excerpt’ field contains three blank spaces, so when you create your template and fill in the ‘Body’ field with your template and then save it, you’ll also be overriding WP generating excerpts by inadvertently adding a manual blank excerpt.  Can this be fixed?

      • http://twitter.com/discoveryalarm Discovery Alarm

        same problem here

      • Anonymous

        Just updated to version 1.1.0.2 and fixed this problem.  Sorry it took so long!

    • The Review Wire

      Same problem 

      • Anonymous

        Fixed.

    • http://ghostseekersrealm.org/ Webmaster

      This plugin is exactly what I needed. It saves me a lot of headaches.  Thank you!  Thank you!  Thank you!

    • MamaRed

      Hi there…just found your plug in and am delirious. I have a “thing” for prestructured content, especially for clients who are learning consistency. I would love to be on a list to hear if/when you have an option for creating multiple templates. Both my client and I do repetitive things like teleseminars and live events…being able to have a custom template for each would leave me more than delirious (if that is possible!). If there is something I can do to help, do let me know please. 

      • Anonymous

        Just released version 2.0 which supports multiple templates: http://wordpress.org/extend/plugins/simple-post-template/

    • Dirty Butter

      I need to be able to put hidden text in the template, but standard messes the site up. Any other way to accomplish this?

      • Dirty Butter

        oops – didn’t show the code – hide with bird beaks and !–

    • http://www.grabbaggraphics.com/ Vannie Kerr Jr

      Good day, I’m using the latest version of your plugin (Simple Post Template) With WordPress 3.3.1. It installs. But, when i try to activate it, i get this message:Plugin could not be activated because it triggered a fatal error.Fatal error: Cannot redeclare encode() (previously declared in /home/content/81/5979681/html/wp-content/plugins/captcha/captcha.php:711) in /home/content/81/5979681/html/wp-content/plugins/simple-post-template/simple-post-template.php on line 96Why is that and can this be fixed? Thank you and have a great day!

      • Anonymous

        You can change all references to encode to spt_encode. My plugin must use the same function name as captcha.

        I’d do a find and replace in both files.

        • http://www.grabbaggraphics.com/ Vannie Kerr Jr

          Thanks, will do!

    • http://twitter.com/XPrime_WebShow Web Show

      dfasdf

    • BN

      It would be nice if it also allow to add some default post tags :)

    • dai

      thank you! this is really nice!this was hard to find because template usually means different thing in wordpress.would be even better with multiple templates that are selectable from a dropdown, please~~ :)

      • Anonymous

        I added this feature today and the new version should not have any problems with html vs visual mode! Check it out: http://wordpress.org/extend/plugins/simple-post-template/

    • Tricia

      I love this idea and plugin, but when I activate it and put some text in the body box and click autofill new posts, all my text and photos show up twice in each post. The post is there, then the social media share buttons and then the whole post appears again, then the comment box at the bottom

    • Carmen

      This is a GREAT plugin.  Would LOVE, LOVE, LOVE if you added multiple templates to choose from!!!

      • Anonymous

        I know. :-(

        I am one of those terrible plugin developers who gets busy and quits innovating.

        • Carmen

           If you are interested in a collaborator – I would be interested in helping out.

          • Anonymous

            Carmen, great news:  I added this feature today! Check it out: http://wordpress.org/extend/plugins/simple-post-template/

    • Anonymous

      Better late than never, I finally added this feature Keith: http://wordpress.org/extend/plugins/simple-post-template/

    • Anonymous

      If you are still in need of multiple post templates, I rewrote the plugin to support this: http://wordpress.org/extend/plugins/simple-post-template/

    • Kevin

      Oh I wish you had left it alone. The new upgrade does not work so I’ve had to reinstall the old version. All I want is a template to load and that’s what the old version did, this updates does….well nothing. 

    • adi28

      nice info
      visit http://mercubuana.ac.id