[pmwiki-users] Google +1 button

Peter Bowers pbowers at pobox.com
Tue Jun 7 17:20:45 CDT 2011


On Tue, Jun 7, 2011 at 6:02 PM, Steve G. <wordz2u at gmail.com> wrote:
> Has anyone figured out yet how to add the google +1 button to individual web
> pages generated by pmwiki?
>
> Here is the code from google:
>
> -----start quote-----
>
> <!-- Place this tag in your head or just before your close body tag -->
> <script type="text/javascript"
> src="http://apis.google.com/js/plusone.js"></script>
>
> <!-- Place this tag where you want the +1 button to render -->
> <g:plusone></g:plusone>
>
> -----end quote-----

Check out these 2 pages for instructions on how to make your own custom markup:

http://www.pmwiki.org/wiki/PmWiki/CustomMarkup
http://www.pmwiki.org/wiki/PmWiki/CustomMarkupAlt

To put hte first part in your header you could do something like this:

===(snip)===
$HTMLHeaderFmt['gplus1'] = '<script type="text/javascript"
src="http://apis.google.com/js/plusone.js"></script>
';
===(snip)===

Then create a (:gplus1:) markup like this (I grabbed the "example"
markup from the first page above and modified it):

===(snip)===
Markup('gplus1', 'directives',
  '/\\(:gplus1:\\)/',
  Keep("<g:plusone></g:plusone>") );
===(snip)===

Then put (:gplus1:) somewhere on the page or pagefooter or whatever --
wherever you want the button to appear.

I haven't tested it, but that should get the HTML you've described
above onto your page...

If you get it working, go ahead and put it as a recipe on pmwiki.org.

-Peter



More information about the pmwiki-users mailing list