WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. csmicfool
    Member
    Posted 11 months 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() {
    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/

  2. Rob Myrick
    Member
    Plugin Author

    Posted 11 months 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.

    Rob

  3. csmicfool
    Member
    Posted 11 months ago #

    My pleasure ;)

    Thanks for the plugin!

Reply

You must log in to post.

About this Plugin

About this Topic