Actions

Mediawiki Google Plus +1: Difference between revisions

From Mike Beane's Blog

mNo edit summary
mNo edit summary
 
Line 1: Line 1:
'''References:''' [
'''References:'''  
* [http://www.google.com/webmasters/+1/button/ Google's Add +1 to your pages to help your site stand out]
* [http://www.google.com/webmasters/+1/button/ Google's Add +1 to your pages to help your site stand out]
* [http://multiplethreads.blogspot.com/2011/07/embedding-1-google-plus-on-mediawiki.html http://multiplethreads.blogspot.com/2011/07/embedding-1-google-plus-on-mediawiki.html]
* [http://multiplethreads.blogspot.com/2011/07/embedding-1-google-plus-on-mediawiki.html http://multiplethreads.blogspot.com/2011/07/embedding-1-google-plus-on-mediawiki.html]

Latest revision as of 09:31, 12 September 2011

References:

  • Edit LocalSettings.php and include the code provided by Google's page above.
    • Example:
$wgHooks['BeforePageDisplay'][]  = 'MyExtensionJavaScript';
    function MyExtensionJavaScript( $out ) 
    {
    # Add Google +1
    $script = '<script type="text/javascript" language="javascript" src="https://apis.google.com/js/plusone.js">'
                    . '</script>';
    $out->addScript( $script);
    return true;
    }    
  • Edit your skin template (mine is SGuMax.php) and add <g:plusone size="small" href="/"></g:plusone>
    • Example:
<h1 class="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?> <g:plusone size="small" href="/"></g:plusone></h1>