2012-05-30 // Add a Google+1 Button to DokuWiki with BlogTNG and the mnml-blog template
How to add a Google+1 Button to a DokuWiki (“Angua” release or later) based blog using the BlogTNG plugin and the mnml-blog template? Here's how:
Download the Google +1 plugin and install it. With the DokuWiki release “Angua” or later, the requirement for the external jQuery plugin is not necessary any more. An internally packaged jQuery is part of the DokuWiki standard distribution since that release.
Edit the plugin to not register for the external jQuery events any more:
- plugins/googleplusone/action.php
... function register(&$controller) { /* $controller->register_hook( 'JQUERY_READY', 'BEFORE', $this, '_addjs' ); */ $controller->register_hook( 'TPL_METAHEADER_OUTPUT', 'BEFORE', $this, '_addscript' ); } ...
Edit the mnml-blog template to insert the Google+1 Button into the lower right corner, just above the footer defined by
blogtng_footer
:entry.php
for individual blog posts:- entry.php
--- entry.php.orig 2012-05-29 23:08:09.000000000 +0200 +++ entry.php 2012-05-30 00:40:10.000000000 +0200 @@ -42,6 +42,9 @@ //skip header true); ?> <div class="clearer"></div> + <div class="sharethis"> + <?php global $ID; echo " <g:plusone href=\"" . wl($this->entry['page'],'',true,'&') . (!empty($anchor) ? '#'.$anchor : '') . "\" size=\"medium\" count=\"true\"></g:plusone>\n";?> + </div> <div class="blogtng_footer"> <div class="level1"> <?php $entry->tpl_created("%Y-%m-%d @ %H:%M"); ?> |
list.php
for the overview of blog posts:- list.php
--- list.php.orig 2012-05-29 23:08:12.000000000 +0200 +++ list.php 2012-05-30 00:11:03.000000000 +0200 @@ -45,5 +45,8 @@ true); ?> <div class="clearer"></div> + <div class="sharethis"> + <?php global $ID; echo " <g:plusone href=\"" . wl($this->entry['page'],'',true,'&') . (!empty($anchor) ? '#'.$anchor : '') . "\" size=\"medium\" count=\"true\"></g:plusone>\n";?> + </div> <div class="blogtng_footer"> <div class="level1">
Add a Stylesheet for the
sharethis
Class:- tpl/mnml-blog/user/screen.css
.sharethis{ text-align:right; padding:0; margin:0; }
After the above changes you should now see a Google+1 Button in the lower right corner of each blog post.