Why doesn’t WordPress ship with a real comments preview?
By “real” I mean- doesn’t rely on JavaScript (so that excludes Comment Live Preview, as nice as that is)
- previews the comments as they will actually look (i.e. with filters applied, etc.)
Why isn’t there at least a plugin for such a comments preview, then?
If there is such a thing, I haven’t been able to find it. This discussion on the WordPress site is the most relevant that I’ve found. There, a post by someone named JoeyDay expresses exactly my sentiments:This is the biggest disappointment for me with WordPress. Why can’t the developers pull their heads out of the sand and put a basic comment preview feature in the core code?ComPreVal, which forces commenters to fix their invalid XHTML before they post, seems close, but I don’t want to add that extra headache to those who aren’t markup-savvy. The best solution I’ve seen so far (and what I’m using here for now) is this hack by MarteyDoDoo.com. I think Martey calls his hack “ugly” because it presents the previewed comments in plain form (no theme styling). I fixed that by replacing his plain header and footer markup with the following, respectively: Header:
<?php
// use the header from the template to format the preview page
$wp_query->query_vars = array(); //necessary to avoid an extract error
get_header(); ?>
<?php
//use the template footer for the preview page
get_footer(); ?>
- Is a plugin relatively simple to install, even for novice users, with no more code editing than perhaps a few lines in a theme’s template.
- Does not rely on JavaScript (as much as I love JavaScript, what users expect is a server-side preview).
- Is robust enough to work across various themes and to show the comments as they will actually appear, e.g. with filters applied.
- Has customizable features that can be set under the dashboard Options, such as whether and how to display previous comments or other blog features, etc.
UPDATED August 15, 2005: I wrote my own plugin to accomplish these goals: Filosofo Comments Preview.
7 Comments
I’m also puzzled as to why WP doesn’t have a comment preview option. At the time of writing, it isn’t even on the list of suggested features for the next version of WP:
http://codex.wordpress.org/Version_1.6
I chose ComPreVal. You can disable the XHTML validation function if you want to. Scroll to the end of the “safehtml.php” file and comment out one line and add “return true;”…
function isOK() {
// return count($this->errors)
Your preview script seems to have removed the last paragraph from my comment. It was displayed OK on the preview page before I clicked “Post”.
Hmmm. I’ll have to look into that. Maybe a special character confused the program?
I used character entities for and , but it looks like they got converted into tag delimiters. ComPreVal doesn’t do that. I looked at the page source and noticed that your comment script inserted ‘nofollow’ twice in the anchor tag:
a rel=’nofollow nofollow’
I haven’t gone live with my blog yet. I’m new to WordPress and I’m still trying out plugins and themes on my local PC and reading online articles to pick up tips. I’m using the WAMP Server for Windows so that I can run Apache/MySQL/PHP as “localhost”:
http://www.wampserver.com/en/
In the paragraph that got clipped I said ComPreVal is designed to work with the WordPress default theme (Kubrick). I had to make a few small changes to adapt it for the WP “Classic” theme.
I figured out the problem. The preview hack keeps the character entities as is, but when they’re put into the value of the textarea, they get rendered as tag delimiters, so when the comment’s finally submitted, they’re no longer character entities.
Anyways, it’s helpful that this problem happened, because I’m working on a previews plugin based on this hack, and now I know to avoid that problem. Thanks.
It’s good that you are working on a comment preview plugin of your own. The criteria you listed in the article are what I was looking for too. At present there doesn’t seem to be much of a choice. I looked at Laughing Lizard’s Comment Preview for WordPress 1.2, but without downloading it I don’t know if it would work with WordPress 1.5, so it’s not quite suitable for novices. ComPreVal is good, but I had to make changes to make it work with the Classic Theme.
I’ve posted my comments preview plugin here. And I’m now using it on this blog. I think I’ve met most of the criteria I listed above, but I’m a little uncertain about its being easy to use by novices.
2 Trackbacks
[…] If you have any problems with that plugin, be sure to look over the comments on the Filosofo’s site. You solution is probably there. If you enjoyed this post, get free updates via email or RSS. […]
WordPress Themes…
Its just great! There are so many sites, which offer free wordpress themes. And if you are searching for a real unique design, there are thousands of programmers and designers which offer their work. Nice to be part of the great wordpress-community. :-…