Where and how to add Google +1 code?...

User 122279 Photo


Senior Advisor
14,649 posts

Jim, I can't find any js regarding the G+ in the head of your site, just the following script where the button is to appear.

<g:plusone></g:plusone>
<script type="text/javascript">

(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>


This works fine! And in order to have the small version of the button, I edited the first line to this:

<g:plusone size="small"></g:plusone>


Melissa, you just have to try out the various 'recipes'. A lot of cooks can be a good thing too, we spot the errors of each other ;)
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 404575 Photo


Registered User
887 posts

The button is rendering ok now, but in Seamonkey it's throwing the text outside to the right, and in Internet Explorer it's throwing just the button outside to the right.
Melissa Rhiannon
OS Windows 10
User 122279 Photo


Senior Advisor
14,649 posts

Melissa Brookstone wrote:

I went back and got the code that's html compliant, so it renders in both browsers now, but it's still throwing the whole table out of whack if I include it in the text td


Could you upload the changes, Melissa? I don't see any changes on your site yet.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 404575 Photo


Registered User
887 posts

Presently:

Attorneys, Legal Assistants and other process serving companies from all across the America love our service!</h4>

<!-- Place this tag where you want the +1 button to render -->
<g:plusone annotation="inline"></g:plusone>

</td>
</tr>

Melissa Rhiannon
OS Windows 10
User 404575 Photo


Registered User
887 posts

Do these validation errors have something to do with this? I'm wondering if I need something in style.css ?

Validation Output: 2 Errors

Error Line 39, Column 139: there is no attribute "annotation"

…ur service!</h4><g:plusone annotation="inline"></g:plusone></td></tr><tr><td><…

?

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.
Error Line 39, Column 147: element "g:plusone" undefined

…ervice!</h4><g:plusone annotation="inline"></g:plusone></td></tr><tr><td><table

?

You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by:
incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "<frameset>" element),
by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).
by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case).
Melissa Rhiannon
OS Windows 10
User 122279 Photo


Senior Advisor
14,649 posts

The annotation can be taken out. If you want to use the term 'inline', add to the style sheet g:plusone {display: inline;}

The g:plusone is being rejected because that is how pseudo classes are written, like e.g. a:hover or a:visited. Whereas that 'a' means 'anchor', there is no definition for a 'g'. We can't change this, that will have to be done by Google themselves. But that is not the reason for throwing everything out of position.

I'm looking into your code, both html and css, gimme some minutes...
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 404575 Photo


Registered User
887 posts

Oh joy! I took out: annotation="inline"
and it works! At least in Seamonkey. Rats! It's still out of whack in Internet Explorer. But that may be the cache setting in Internet Explorer?
Melissa Rhiannon
OS Windows 10
User 404575 Photo


Registered User
887 posts

Yeah it was the cache for Internet Explorer. I turned off the plugin W3 Total Cache and now it works in Internet Explorer too.

I still get one validation error

Error Line 102, Column 12: element "g:plusone" undefined

Even though I added
g:plusone {display: inline;}
to style.css so I'm not sure what I need with that now, to fix it.
Melissa Rhiannon
OS Windows 10
User 122279 Photo


Senior Advisor
14,649 posts

Great that you got it sorted! I was getting there too, but with the WP system I don't get the right files, just the ones that have been generated, therefore it is a bit more complicated.

Anyway, well done!
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 122279 Photo


Senior Advisor
14,649 posts

That one error will continue to be there until Google does something about it. They should, actually.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com



Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.