base_id, // Base ID $this->name // Name ); add_action( 'widgets_init', function() { register_widget( $this::class); }); } public $args = array( 'before_title' => '', 'after_title' => '', 'before_widget' => '', 'after_widget' => '', ); private function getTemplatePath(){ return get_template_directory()."/template-parts/widgets/".$this->template_path; } public function widget( $args, $instance ) { #dd($instance); if(!$this->restricted || (current_user_can($this->restricted))){ require($this->getTemplatePath()); } } public function form( $instance ) { $count = ! empty( $instance['count'] ) ? $instance['count'] : 1; ?>