WordPress.org

Support

Support » Plugins and Hacks » Google Plus One ( 1) Plugin (w3c validator neutral)

Google Plus One ( 1) Plugin (w3c validator neutral)

  • Hi!

    while using some google plus one plugins from the plugin browser i got a lot of validation warnings from w3c’s validator. To make it short: I don’t like warnings and i wanted my site to be 100% valid XHTML code. So i created a plugin of my own – but: I’m too lazy to go through all the plugin registration stuff – however maybe someone will find this useful. Here is the complete code of the plugin. Despite the bits that are required to be GPLv3 because of the wordpress licence i’m giving it to you as public domain. Use it well!

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Oh right, this it what it does:
    – Adds an empty <div> with the post id to each post.
    – Buffers the post ids
    – Places a javascript piece at the end that replaces the divs with the Google PlusOne code
    – Google does the rest for you

    Validators don’t execute javascript, so it will only see an empty div-tag which is XHTML strict compatible.

    … and if you like it… put some cheers in this thread so i can return here and be happy 🙂

    konqi

Viewing 5 replies - 1 through 5 (of 5 total)
  • Code pasted in pastebin as requested:
    http://pastebin.com/zn9mvByr

    Sorry…

    cheers

    konqi

    I am receiving validation errors too and am not a programmer. Can you walk me through what to do? Will this override any other plug-ins I have for google+…..I’m using WP Biographica and I have another plug-in that puts the icon at the end of my posts. Thanks.

    1) Copy the code into a file called something like ‘wp_googleplusone.php’.
    2) Upload the file into your plugins directory
    3) Enable plugin in wordpress

    It will not override any other plugins.

    You can see how the plugin works on my website.

    Hi. I did the above but there is not Google+ sign on my posts…I did pass validation which is great. Any idea what’s wrong or am I supposed to do something else? Tx Chel

    chelliesworld.com

    FYI f/u I could not get it to work. I am using this one
    Google +1 (Plus One) Share Plugin and it works and passes validation

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Google Plus One ( 1) Plugin (w3c validator neutral)’ is closed to new replies.
Skip to toolbar