Skip to content

Instantly share code, notes, and snippets.

@brasofilo
Last active December 17, 2015 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save brasofilo/5631817 to your computer and use it in GitHub Desktop.
Save brasofilo/5631817 to your computer and use it in GitHub Desktop.
GlotPress plugin to hide Google Translate, which doesn't work anymore with GP.
<?php
/**
* Hide Google Translate elements from GlotPress interface
* Put this file in the folder: /glotpress/plugins/
*/
class Glot_No_Google extends GP_Plugin
{
private $pagenow = false;
function __construct()
{
parent::__construct();
$this->add_action( 'pre_tmpl_load', array( 'args' => 2 ) );
$this->add_action( 'gp_head' );
$this->add_action( 'gp_footer' );
}
function pre_tmpl_load( $template, $args )
{
if( 'translations' == $template )
$this->pagenow = true;
return $template;
}
function gp_head()
{
if( !$this->pagenow )
return;
echo '<style type="text/css">.gtranslate { display: none; }</style>';
}
function gp_footer()
{
if( !$this->pagenow )
return;
echo <<<HTML
<script type='text/javascript'>
jQuery(document).ready(function($) {
$('#bulk-actions-toolbar select option[value="gtranslate"]').remove();
});
</script>
HTML;
}
}
GP::$plugins->glot_no_google = new Glot_No_Google;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment