This is my first WordPress plugin ever, so i'm a little noob. But why is my widget not showing within all the other widgets in my WP-Admin interface? It should be visible when i activate the plugin. But it's not. Any help appreciated!
includes/class-level_system-widgets.php
class Level_system_Widgets extends WP_Widget {
public function __construct(){
$widget_ops = array(
'classname' => 'my_widget',
'description' => 'My Widget is awesome',
);
parent::__construct( 'my_widget', 'My Widget', $widget_ops );
}
public function widget( $args, $instance ) {
// outputs the content of the widget
}
public function form( $instance ) {
// outputs the options form on admin
}
public function update( $new_instance, $old_instance ) {
// processes widget options to be saved
}
public function init() {
add_action( 'widgets_init', function(){
register_widget( 'My_Widget' );
});
}
}
level_system.php
function activate_level_system() {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-level_system-widgets.php';
Level_system_Widgets::init();
}
register_widget("Level_system_Widgets");
.