WordPress.org

Ready to get started?Download WordPress

Forums

Simple Image Widget
[resolved] Filter or another way to change the title of the widget in admin (2 posts)

  1. suzt808
    Member
    Posted 2 months ago #

    Hello
    I'd like to change the name "Image" that is shown in the admin widget area.
    This change is to make it more obvious for the client's usecase.
    Is there a filter available to change that ? Or is there another recommended method that will allow for updates ?

    Thanks

    http://wordpress.org/plugins/simple-image-widget/

  2. Brady Vercher
    Member
    Plugin Author

    Posted 2 months ago #

    Hi there. A filter doesn't exist for changing the widget title, but you can easily create your own custom widget by extending this widget. Something like this might work (untested):

    <?php
    if ( class_exists( 'Simple_Image_Widget' ) ) {
    	function myprefix_widgets_init() {
    			// Register the widget.
    			register_widget( 'My_Image_Widget' );
    	}
    	add_action( 'widgets_init', 'myprefix_widgets_init' );
    
    	class My_Image_Widget extends Simple_Image_Widget {
    		function __construct() {
    			$widget_options = array( 'classname' => 'widget_my_image', 'description' => 'Not yours.' );
    			parent::__construct( 'my-image', 'My Image Widget', $widget_options );
    		}
    	}
    }

Reply

You must log in to post.

About this Plugin

About this Topic