Support » Plugins and Hacks » Google Plus One Button » 1 button W3C validation

1 button W3C validation

  • Hi. I apologize for my English, I know it is not the best…
    The plugin works fine, but unfortunately the W3C Validator give me 4 errors. Is it possible to resolve?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author jeremyarntz


    I can look in to it. What’s your site URL? I just ran WC3 Validation on my own site and all the errors that came back involving the Google +1 Button I don’t believe are possible to fix, but I can try.

    Thx for your quick reply.
    My site URL is: http://www.guidedolomiti.com/wp/

    Plugin Author jeremyarntz


    It looks like the Google +1 Button isn’t WC3 Compliant:


    Hey, I just posted a article about this here: http://james-ingham.co.uk/posts?p=google-plusone-w3c-valid. Just chuck it in a document.write using javascript and you’ll pass w3c (although it isn’t valid). Example code is in that post.

    The simplest way to make Google Plus One code to validate:
    Just put <div class=”g-plusone”></div> instead of <g:plusone></g:plusone>.
    Drawbacks: you cannot add parameters such as ‘count’ or ‘size’, or the code will not be valid any more.
    It’s Google’s proposed code for HTML5, but will work for other (X)HTML flavours.
    In HTML5 you CAN add parameters such as ‘data-count’, data-size’, etc.

    I have the same Problem with my site http://www.sususumm-shop.de. I’ve put a googgle +1 in my code and after that there was an error in my validation like:
    Line 206, Column 56: Element name g:plusone cannot be represented as XML 1.0.
    Is this a google error or can i do something against it.

    Hello rdelavega i’ve tried <div class=”g-plusone”></div>

    <div class=”g-plusone” size=”small” callback=”www.sususumm-shop.de”></div>

    but now i have 3 errors instead of 2

    Have a look at my post http://wordpress.org/support/topic/google-plus-one-1-plugin-w3c-validator-neutral

    Plugin works on my page… Have fun!

    for w3c validation for google+, facebook api or twitter plugin you can user javascript document.write covered by xml CDATA.

    please find the following link for more details script,

    w3c validation for google +1 and facebook api

    Both twitter and facebook use iframe’s. The nasty javascript code they supply runs on the clients PC after your page has been sent to the client and inserts HTML code into your page. How dare it not be W3C compliant! After being annoyed by this I created my own buttons and a php script to fetch the counter values so I could insert them into my page myself BEFORE the client receives it.

    // get twitter count
    $url = 'http://www.YOURDOMAINHERE.COM';
    $twitterUrl = 'http://urls.api.twitter.com/1/urls/count.json';
    $twitterQuery = urlencode($url) . '&callback=twttr.receiveCount';
    $twitterStr = file_get_contents("$twitterUrl?url=$twitterQuery");
    $s = strpos($twitterStr, '{');
    $e = strpos($twitterStr, '}');
    $l = $e - $s + 1;
    $jsonTwitter = json_decode(substr($twitterStr, $s, $l), true);
    $twitterCount = $jsonTwitter['count'];
    // get facebook count
    $url = 'http://www.YOURDOMAINHERE.COM';
    $facebookUrl = 'http://graph.facebook.com';
    $facebookQuery = urlencode($url);
    $facebookStr = file_get_contents("$facebookUrl?ids=$facebookQuery");
    $jsonFacebook = json_decode($facebookStr, true);
    $facebookCount = $jsonFacebook[$url]['shares'];
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘1 button W3C validation’ is closed to new replies.
Skip to toolbar