Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In response to Mike Schinkel's comment (see below) on my post about how to pre-populate content (essentially using a content template)...

@Scott B I mean why did you support a file on disk rather than an place in the admin? For multiple, have you considering created a "Sales Letter" custom post type?

No, but it sounds like a better solution. How would you do it and where would you store the choices for the content? (I assume you might have a few different types of content templates to offer.)

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Hi @Scott B:

Your question got me thinking about extending your use-case to a plugin I published earlier called WP Boilerplate Shortcode. I know your question isn't about shortcodes but the name is only legacy for your use-case; indeed my extension I just added because of your question will do (almost) exactly what you are asking for (I'll explain the "almost" part below).

I'm going to have to come back and document this more in-depth but I figured I've give you first access to it sooner than later (note the instructions.txt file does not address the new features yet):

The easy part of doing what you ask was the back-end coding; the harder part was figuring out a good UI. If there are multiple content items to choose from the user needs a way to select which one to use and there's not one obvious way to do that.

One approach I could have used would have been to intercept when the user clicked "Add Post" and ask them which pre-populated content item they want to start with but that seemed kludgy and not in line with how the WordPress admin normally works. So instead I added a "Insert Boilerplate" metabox with a dropdown containing the list of available boilerplate text items.

To use this plugin download, copy to a subdirectory in your /wp-content/plugins/ directory and then activate it. After activation look for the "Boilerplate" menu and start adding your sales Letters as Boilerplates being careful to selecting the "Associated Post Types" for which you want each Boilerplate to be active. Then in the "Add {post type}" window in the admin look to the top right; you'll find the content from the boilerplate to the end of whatever is currently in the content editor:

Screenshot of WordPress 3.0.1 and the Metabox from WP BoilerPlate Shortcode v1.0.5

Note that upon activation the plugin will add any post types you might have into the "Associated Post Type" taxonomy but if you add new post types later you'll have to add them manually; just make sure to match exactly the plural name of the post type (i.e. "Products" or "Featured Posts" or whatever.)

This isn't exactly what you asked for but given the need for a way to select content I think it's a really workable solution. I'd love to get your feedback on what you think of it.

share|improve this answer
    
Wow Mike! Above and beyond. This is pretty awesome stuff:) The only problem I have is upon activating it > Fatal error: Call to undefined function make_post_type_labels() in C:\xampplite\htdocs\mysite\wp-content\plugins\wp-boilerplate-shortcode\wp-boiler‌​plate-shortcode.php on line 140 –  Scott B Sep 9 '10 at 21:21
    
@Scott B: Well that was a bit embarrassing. Yes make_post_type_labels() is one of my personal "library" functions I use everywhere and I forgot to copy it in. I've updated the download file to include it so to try it you should delete the broken plugin, load the plugins page at /wp-admin/plugins.php to clear it from WordPress' list of plugins, then install and activate the new version of the plugin you downloaded. Looking forward to your reactions. –  MikeSchinkel Sep 9 '10 at 23:42
    
Am I to understand that this plugin will allow you to create custom types of content to use within posts as well as pages? If so, I might be able to use this plugin for a specific type of local directory I have been wanting to use. Do you know if there are any conflicts with any other plugins at this time? Also, is the version inside of WP Plugin Directory the standard version or do you have an updated version that I could beta test? –  user4241 Mar 26 '11 at 21:41
    
I hope it's OK to ask here instead of at wordpress.org. Would it perhaps be possible to use the insert boilerplate feature using the the HTML editor as well? Even though the menu is there, it seems to not function. –  Cor van Noorloos Jun 4 '11 at 12:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.