Live Entry Preview Plugin for WP
I mentioned the other day that I missed the preview entry feature that MT has. It became even more apparent to me that it would be nice to have such a feature when I began to play with future-posting. If I wanted to “preview” my entry (look for far too frequent syntax/logic errors, that is), I had to actually post it, load the site, and then come back and edit the entry, adjusting the timestamp to reflect the time it should actually post at. This was kind of a pain.
At the same time, I manged to fall in love with the Live Comment Preview plugin that shows visitors what their comment will look like once posted, in real time. I put two and two together and decided it would be great to be able to have a live preview for entries.
So I modified the source of the plugin so that it would work with post editing instead. If you want to try it out, just download (use this link instead for the latest version) and then upload (be sure to remove the txt extension it has now) to /wp-content/plugins and activate it. (I didn’t even change the attributes for credits and such that you see in the plugin manager except for the name) Then all you need to do is add the line < ?php live_entry_preview(); ?> to /wp-admin/edit-form-advanced in the place that you’d like it to show up. (try right above the line that says < ?php _e('Advanced'); ?>).
And BTW, you must be using the advanced form for this to work. (This can be set under the options page) As it is right now, it is only setup to use the advanced editor and not the normal one.
Mind you, the code is pretty rough, as far as my modifications go. It works fine, but I’d clean it up before I’d do a whole lot with it.
I really didn’t do a whole lot with the source to make it work. It took me a little while to do because I had no clue what I was doing. Essentially, I just deleted a little bit of code that was no longer needed and changed a few things here and there so it would work with a different form and use a different hook for the different page in WP. Then I changed the function names around to avoid a naming conflict in PHP as I was testing this when I already had the original plugin installed.
I’m not sure exactly what to do with this though. I’m sure I’ll see good use out of it, and I imagine that there must be others like me that wouldn’t mind it either. The way I see it, I have two choices. I can either clean it up, write it off as it’s own plugin, giving thorough credit to the original authors of course, and post it in plugin directories. I feel like I did so little with the source though that that isn’t the best option. My other option, as I see it, is to submit my modifications to the original authors as a next version of the plugin. This option seem more “correct” in that I’ve done so little work on it, however, ironically, in order for me to go with that option I’d have to do some more work to make it plugin understand what form it’s working with so it uses the correct form ID’s and hooks.
In a way, the latter makes the most sense because then it can be one plugin instead of two, and like I said, I didn’t really do a whole lot. On the other hand, the former makes sense because there won’t be extra code to write and for all I know very few people would be interested in an entry preview and it would be just as well off as a second plugin that people can install if they want to (of course, even if it was all one plugin, they wouldn’t get a preview until that function is added to the editing form anyways)
It’s partially a design issue and partially an issue of etiquette towards the authors. Anyone have any suggestions?
On a final note, it’s really cool to do this and be able to put the GPL to use. It’s always nice to have the source available and everything, but this is the first time I’ve actually taken that source and improved upon it. It’s good stuff I tell ya.
No TagsPopularity: 3% [?]






As I think about this more and more, it seem to make the most sense to me to contact the plugin’s authors and ask them if they’d be interested in a new version with said capabilities. If not, then I can just make it a seperate plugin. I’ll have to shoot them a line later on.