Google Plus One Button
+1 button W3C validation (11 posts)

  1. drunkfox
    Posted 5 years ago #

    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?

  2. jeremyarntz
    Plugin Author

    Posted 5 years ago #

    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.

  3. drunkfox
    Posted 5 years ago #

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

  4. jeremyarntz
    Plugin Author

    Posted 5 years ago #

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


  5. james.ingham
    Posted 5 years ago #

    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.

  6. rdelavega
    Posted 5 years ago #

    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.

  7. amdamdeath
    Posted 5 years ago #

    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.

  8. amdamdeath
    Posted 5 years ago #

    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

  9. konqi.de
    Posted 4 years ago #

    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!

  10. Rupam Guha
    Posted 4 years ago #

    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

  11. Frank Leigh
    Posted 4 years ago #

    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'];

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Google Plus One Button
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic