Skip to content

Commit aaba5c6

Browse files
Change the widget register method
1 parent 5bf5adf commit aaba5c6

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

includes/admin/feedzy-wp-widget.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class feedzy_wp_widget extends WP_Widget {
3737
* @param Feedzy_Rss_Feeds_Admin $plugin_admin The Feedzy_Rss_Feeds_Admin object.
3838
*/
3939
public function __construct( $plugin_admin = null ) {
40-
parent::__construct( false, $name = FEEDZY_NAME );
40+
parent::__construct( false, $name = __( 'Feedzy RSS Feeds', 'feedzy-rss-feeds' ) );
4141
self::$instance = $this;
4242

4343
}
@@ -57,16 +57,6 @@ public static function get_instance() {
5757
return self::$instance;
5858
}
5959

60-
/**
61-
* The register method for registering this widget class
62-
*
63-
* @since 3.0.0
64-
* @access public
65-
*/
66-
public function registerWidget() {
67-
register_widget( 'feedzy_wp_widget' );
68-
}
69-
7060
/**
7161
* The widget form creation
7262
*

includes/feedzy-rss-feeds.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,13 @@ private function define_admin_hooks() {
229229

230230
add_shortcode( 'feedzy-rss', array( self::$instance->admin, 'feedzy_rss' ) );
231231

232-
$plugin_widget = new feedzy_wp_widget();
233-
self::$instance->loader->add_action( 'widgets_init', $plugin_widget, 'registerWidget', 10 );
232+
add_action(
233+
'widgets_init',
234+
function () {
235+
register_widget( 'feedzy_wp_widget' );
236+
}
237+
);
238+
234239
self::$instance->loader->add_action( 'rest_api_init', self::$instance->admin, 'rest_route', 10 );
235240

236241
// Wizard screen setup.

0 commit comments

Comments
 (0)