Google Language Translator
[resolved] Suggested Addition (3 posts)

  1. csmicfool
    Posted 2 years ago #

    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() {
    '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


  2. Rob Myrick
    Plugin Author

    Posted 2 years ago #

    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.


  3. csmicfool
    Posted 2 years ago #

    My pleasure ;)

    Thanks for the plugin!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Google Language Translator
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic