Live Post Preview 1.0
After discussing the issue that I mentioned the other day regarding some modification that I did to an existing WordPress plugin with it’s author, I have decided to release my changes as a new plugin.
Live Post Preview is a WP plugin that alows you to preview your post in real time as you type it. It’s based on Live Comment Preiview which allows you to view your comment in real time as you type it. It was a pretty easy conversion from one to the other, I must admit.
It’s Thursday now (by the clock, anyways) and I started playing with this on like Sunday. I’ve just now finished. My changes may have been minor, but my efforts weren’t for sure….
First of all, I had to learn about plugins and how things worked and stuff in order to understand enough about what was going on to make the new plugin work. Then, I changed the names of variables and functions so that the naming would make sense in the new context (and to avoid naming conflicts within PHP). Then…..well, then nothing. Then it wouldn’t work. Technically, then I spent hours looking over the code, learning more about how it worked and event handling and crap and it still didn’t work. Then I started over from scratch, modifying the original plugin again. This time it worked just great and in a quarter of the time I’d spent attempting to debug my last screwup…. I’m still not sure what I did wrong (some minor syntax error could fail to create an error and just cause the whole thing to not work though…sucks). I should really diff the screwed up copy and the good copy and see what I get..
Then I setup hosting on dev.wp-plugins.org and then I had to learn about wiki formating and version control in order to get everything setup right. Then I had to write a post about it and then I had to have bad grammar and start every sentance with then just for fun…
Then So that took some time. It’s safe to say that I learned a lot. I still have a lot of stuff I want to look over about versioning. I’m not completely sure what I’m doing just yet, but it seems like cool stuff really.
The nicely ironic part about the whole thing is that in the process of doing this, I discovered two built-in ways of previewing a post without having to publish it first. First of all, Jeff, author of Live Comment Preview, recommended just saving the post as “private” and then viewing it. It will show up on your site only to you as that way (and WP knows that you’re you via cookies so there’s no messing around with authentication at all). This is probably the 100% best way to preview a post because you’ll see it exactly as it would look to anyone else. That is, using the correct stylsheet and surroundings (theme).
The second way that I found is that if you click on the “save and continue editing” button, WP will generate a preview at the bottom of the screen. (it does this for all posts that have been saved) Of course, you don’t get to see it in the correct context, but it’s a preview none-the-less.
To me, the preview is just important so I can confirm that I haven’t made any errors that do something silly like, make half the post into a link or bold or something. I also like to verify that my links work. Most of my posts don’t have pictures, but of course it’s useful to see how the layout will look when I do. I’ll just stick with the live preview for now…
Another interesting tidbit that I picked up on is that virtually any plugin made for WP has to be GPL’d since WP is. Makes sense, I just never thought about it before. How handy.
No TagsPopularity: 48% [?]






Nicely done. Now you can use all that learned WP knowledge and apply it to many more plugins!
:cheers:
Hi,
I think there is a minor mistake at the Live Post Preview link.
I think it should be :
live_post_preview();
instead of :
live-post-preview();
Because it didn’t work for me when I put “-” instead of “_”.
By the way, thanks for your plugin.
What? You mean it doesn’t work when the function I tell you to use doesn’t exist? Whoops…..details detail details……
Indeed. I would never write a funciton that uses dashes as a delimeter….too many naming conventions going through my head obviously. I just changed the wiki to reflect the actual function name. Thanks for the info.
Nice, this must be about the best preview plugin there is at the moment. But still,
<div id="commentPreview"></div>isn’t very semantic…The installation instructions say to put into /wp-admin/edit-form.php OR /wp-admin/edit-form-advanced. Is there a specific place in these files to place the code? Could it be put into both files?
An idea for an improvement would be if you could get it to preview restecting the text settings in the CSS for the active theme. That way you don’t just see a preview but you see it exactly how it would be formatted in your blog theme.
Good question, Dave. The function call can be put anywhere in either of the files and it will work. Where you put it will change where it displays at though. For both files, I’d recommend placing it as the last line in in the file as this will cause it to display right underneath the buttons you use to save the post and whatnot. If you want it to display higher up, just try moving it around and see where it ends up.
It can be placed into both files. Only one form will be used at a time, but it won’t cause any problems to have it in both.
I’ll change the wiki to explain this as well.
Thank you for the suggestion as well.
Haha…LoL. I guessed too many naming conventions going through your head too. Anyway, I should have given more information about the function name.
The plugin works great. Love it so much.
I was only thinking of the live comment plugin. That was more helpful for blog visitos and this is more helpful to the blog owner. Thanks for the great work.
Happy Friendship Day!
I would love if everybody could see the post preview.
Is there a plugin for it? Post Live Preview for the readers?
Post preview for the readers? You lost me….there is a live preview for comments (see link above), but I’m not exactly sure why you would want readers to preview posts before they’ve been published. Authors would of course want to do so, but they have access to the WP control panel, so of course they can see the output from Live Post Preview. You lost me.
Hi!
Nice Plugin, thank you. But i had a big big problem. First if i have installed it, i could not write a new comment, because i do not see my comment-form. (i could see old entries, but i can not do new entries). SO i have deactivate the plugin in the admin panel, but i also do not see my comment from to write comments. So what sould i do, that i could write new comment entries?
please help
What version of WP are you using?
I never updated it for 2.x since WP already has an excellent preview built in now. Given, it’s not updated as you type, but it’s pretty quick to just hit the “save and continue button”, and the preview is much better since it shows exactly how it will look on your site. At any rate, I never bothered to even see if it would still work with 2.0 (it seems like when I was reading about it, they changed some things that would break it, come to think of it).
[…] Live Post Preview: Añade una vista previa al formulario de nuevas entradas. […]
[…] Live Post Preview: Añade una vista previa al formulario de nuevas entradas. […]
[…] Live Post Preview: Añade una vista previa al formulario de nuevas entradas. […]
[…] Live Post Preview: Añade una vista previa al formulario de nuevas entradas. […]
[…] Live Post Preview: Añade una vista previa al formulario de nuevas entradas. […]