When reworking the theme for this blog, I decided I wanted to add the Twitter-style quick post box from the Prologue theme to my theme. Instead of adding it directly to my theme though, I decided to try to write it as a plugin. Lo and behold, I succeeded:

I don’t know why—it’s not that much work to use the WP admin backend—but this seems to make blogging seem much more inviting to me. I basically just took the relevant code from the Prologue theme, modified it a bit (adding a “Title:” field, for example) and found the correct WP hooks to put it in Plugin form.
I’m actually thinking about releasing it as a real plugin. When I mentioned this to my friend James, he recommended the name “Posthaste.” James is much better at naming things than me, so I took his recommendation.
If this sounds interesting to you, you can download it and try it out. If it seems useful to other people & actually works well enough, I may submit it to the WP plugin directory. I tested it with a handful of the most popular themes on the WordPress Theme Directory and it seemed to work with them all.
A few notes:
- If you leave the “Title:” field blank, it takes the first 40 characters of the post content & makes that the title.
- It posts to your default category…unless
- If you have a category named ‘asides’, it will put posts with empty titles in the ‘asides’ category. You can then style them as asides, which is what I do on this blog.
- If you want to change any of this behavior, there’s no options page or anything: you’ve got to edit the php file.
- It only has the most basic CSS applied. To customize it, you can add custom CSS to the ‘styles/local.css‘ file.
- Your theme needs to use wp_head() for it to work. If you’re using a new theme at all, it probably does.
- There’s an ongoing problem with Prologue in WP 2.6. I fixed it, I think, by changing the auth_redirect() code. If you know more than me about these matters, and my “fixing it” this way was a bad idea, please let me know. (This was supposedly fixed in Prologue 1.4.1, but I’m still having the same problem.)

Comments
Tapeleg 2:55 pm on October 19, 2008 | link
I would love to see what you did to add the title field to the post area. I’m wanting to add a few more fields to the prologue theme, and this would be really helpful for someone like me who is just dangerous enough with a little knowledge.
Jon 5:19 pm on October 19, 2008 | link
Look at posthaste.php and the index.php for the Prologue theme. There are two places you’ve got to make changes: the form itself and the function at the top of the file that processes the form. In my plugin, the form is in posthasteForm function and the post processing function is in the posthasteHeader function. If you just look at the theme and the plugin side by side you should be able to see the differences.
Basically you need to:
In the form:
- Add the label and input for the post title in the form. In my form, this input is named “postTitle”. That’s important in the next two steps. (line 99-101 in my plugin)
In the post processing function:
- assign the data in $_['postTitle'] to a variable. I used $postTitle. You can use the existing examples for $_['tags'] and posttext as a template. (line 55 in my plugin.)
- Add your title to the wp_insert_post array right below that, pointing your new $posttitle to WordPress’ 'post_title' for your post. (line 72 in my plugin.)
-If you want to have WordPress create a title automatically out of your body content when the title field is left empty, add the function if (empty($postTitle))… between assigning the postTitle variable and the wp_insert_post (line 58-68 in the plugin). Otherwise, delete the the if (strlen($post_title)… function from the prologue theme (or it’ll chop off your titles).
Hope that helps.
Omgro 2:20 pm on October 21, 2008 | link
Wow, This is the solutions Im looking for almost 3 weeks upon launching our FREE SMS Classified directory, based on Prologue Theme. Thanks buddy for the great tips. You can see it in action at http://www.omgro.com
Madcore 3:09 pm on November 8, 2008 | link
I´ve managed to include suport for custom fields to the basic Prologue form, using the
add_post_metafunction. It´s really easy. I´ve made it this way:Created a new input, with name and id set to “custom_field_name” (it can be anything you write). Label can be anything. Then, you need to asociate the input id to a variable, like this:
$custom_field_variable = $_POST['custom_field_name'];After it, you need to put this piece of code before “wp_redirect( get_bloginfo( ‘url’ ) . ‘/’ );”:
add_post_meta($post_id, 'custom_field_name', $custom_field_variable, true);And voila, you now have a personalized custom field input ond your Prologue form.
I don´t have tried it already with your plugin, only in the original Prologue theme, but I hope explained it well to make you capable to include this option on the plugin. It can become a great util for Wordpress users.
PD: English is not my native language, so sorry about any wrong sentence or word.
Jon 9:56 pm on November 8, 2008 | link
@Madcore: Cool!
the333 10:59 pm on November 19, 2008 | link
Very nice - TDO Mini forms does a similar thing, but yours is much more elegant.
Is there any way to get this to display category drop down instead of tags?
Jon 4:14 pm on November 21, 2008 | link
@the333: that’s a good idea and that shouldn’t be too hard to add. I hope to get around to cleaning this up soon and submitting it to the WP plugin directory. I’ll see if I can add that.
links for 2008-12-02 « Sean’s Emerging… 9:04 am on December 2, 2008 | link
[...] Enhanced Learning » Publications Education 2.0? » Designing the web for teaching and learning.Posthaste WP Plugin » jon.smajda.com/blogePresence / WebcastingEDUCAUSE Review Magazine, Volume 43, Number 5, September/October 2008 | [...]
Leave a Comment