WordPress.org

Support

Support » Plugins and Hacks » Google Language Translator » [Resolved] Suggested Addition

[Resolved] Suggested Addition

  • I added the following code to my installation so that users in our system can add a google translate widget without the need for shortcodes. This is just a basic widget you can drag-and-drop anywhere. Settings are still controlled the same as before.

    add_action( ‘widgets_init’, create_function( ”, ‘register_widget( “Google_Translate_Widget” );’ ) );
    /**
    * Adds Google_Translate_Widget widget.
    */
    class Google_Translate_Widget extends WP_Widget {

    public function __construct() {
    parent::__construct(
    ‘bapi_google_translate’, // Base ID
    ‘Google Translate’, // Name
    array( ‘description’ => __( ‘Go to Settings >> Google Language Translator to configure this widget.’, ‘text_domain’ ), ) // Args
    );
    }

    public function widget( $args, $instance ) {
    extract( $args );
    $title = apply_filters( ‘widget_title’, $instance[‘title’] );

    echo $before_widget;
    echo google_translator_shortcode();
    echo $after_widget;
    }

    } // class Google_Translate_Widget

    http://wordpress.org/plugins/google-language-translator/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Rob Myrick

    @rm2773

    Hi csmicfool,

    I will add this to the next update. I like this idea, and agree it would be a seamless feature that everyone would appreciate. Thanks for sending the code as well.

    Rob

    My pleasure 😉

    Thanks for the plugin!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Suggested Addition’ is closed to new replies.
Skip to toolbar