The Sociable plug-in for WordPress can cause a W3C validation conflict because both the plug-in’s e-mail button and the WordPress comment form’s e-mail field have the ID “email.” Here’s how to fix it.
Sociable is a great plug-in that adds buttons at the bottom of your posts for readers to print, e-mail or share the posts on social networking sites.
If you use Sociable’s “E-mail this story to a friend!” button, you may get a validation error, “ID ‘email’ already defined,” if the blog post also has the WordPress comment form showing.
This is because both Sociable’s e-mail button and the comment form’s e-mail field use the same ID: “email.”
The fix is easy. Open up sociable.php and find the following section (it’s right after a comment that begins “Start building the link …”):
$link .= '<a rel="nofollow"';
$link .= ' id="'.esc_attr(strtolower($sitename)).'"';
if (get_option('sociable_usetargetblank')) {
$link .= " target=\"_blank\"";
}
$link .= " href=\"javascript:window.location='".urlencode($url)."';\" title=\"$description\">";
Immediately before this section, add the following:
if ($sitename=='email') {
$sitename .= '-sociable';
}
This will add “-sociable” to the ID of the Sociable e-mail button, making it “email-sociable” instead of simply “email.” Because the name is different, there will be no more “ID ‘email’ already defined” validation error.

Subscribe via RSS
Follow me on Twitter
Connect with me on LinkedIn
Recent Comments