WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] g+ Implementation (3 posts)

  1. sangram.patra
    Member
    Posted 2 years ago #

    Anyone is there.

    I want to use g+ share button in my author page to share my custom link to g+ but i am not able to do this.

    I have written the code like below :

    <script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
    <g:plusone href="<?php echo get_permalink();?>"></g:plusone>

    I know ther is a plugin for that but i want to use it only for custom link share link.

    Thanks.

  2. Marventus
    Member
    Posted 2 years ago #

    Hi,

    Your issue is most likely related to the fact that you are using the HTML 5 version instead of the XHTML version. Your theme is very likely to be coded in XHTML and not in HTML 5.
    Add this line of code in the <head> section of your blog in header.php, before the </head> tag:

    <script type="text/javascript" src="https://apis.google.com/js/plusone.js">
    //<![CDATA[
    { parsetags: 'explicit' }
    //]]>
    </script>

    and place this code where you want the g+ button to appear:

    <div id="plusone-div"></div>
    <script type="text/javascript">
    //<![CDATA[
    gapi.plusone.render
    (
        'plusone-div',
        {
            "size": "standard",
            "count": "true"
        }
    );
    //]]>
    </script>

    If you wish, you can change the appearance of the button by changing the size parameter and enable/disable the share count. For more information about these paramters, you should check out the g+ documentation.

    Cheers!

  3. Marventus
    Member
    Posted 2 years ago #

    Hi,

    Were you able to figure this out? If so, could you please mark this thread as resolved?

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic