WordPress editable comments

If you’re anything like me, then there’s bound to have been times where you’ve written something, clicked the send or submit button and then realised later that you’ve left a typo in your wake.

Sure, we should all take the time to check over our text before setting it in concrete but then again we’re only human.

Thanks to our tendency to rush into things I decided to go in search of a WordPress plugin that would allow people to edit the comments they leave on this site… Editable Comments by Julien Appert was what I found.

The plugin allows users to edit their own comments based on a time limit set in the admin section. Although it wasn’t entirely what I was after right out of the box, I was able to disable the plugins CSS and use my own by doing the following:

Add code to comments.php

Or functions.php depending on where your comments code is.

<?php if ( class_exists( 'WPEditableComments' ) ) { WPEditableComments::link('Edit'); } ?>

Remove plugin styles

You’ll need to add this to your functions.php file.

add_action( 'wp_print_styles', 'my_deregister_styles', 100 );

function my_deregister_styles() {
    wp_deregister_style( 'dialog' );
    // deregister as many stylesheets as you need...
}

Then use the following CSS identifiers

Just work your CSS magic in your stylesheet.

.ui-dialog-titlebar { }
.ui-dialog-title { }
.ui-dialog-titlebar-close { }
.ui-dialog-titlebar a:hover { }
.ui-icon { }
#dialog.ui-dialog-content { }
#dialog_content { }
#dialog_commentform { }
#dialog_loader { }
#dialog_comment { }
#editable_comment_buttons { }
#editable_comment_buttons input { }
#editable_comment_buttons input:hover { }
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

In closing

Hopefully this will be useful to those of you that would like to add this feature to your own WordPress site.

Please feel free to leave a comment below and check it out for yourself. I’ve since disabled comments so unfortunately you won’t be able to see it in action here. However, you can still check it out on the plugin authors website.