From 5bc610a2cf38fb87e86eafef86a37d6c60c4fb07 Mon Sep 17 00:00:00 2001 From: ulaulaman Date: Thu, 19 Nov 2020 22:08:36 +0100 Subject: [PATCH] Aggiunto il widget del corso base di astronomia --- sidebars/widgets.php | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/sidebars/widgets.php b/sidebars/widgets.php index cd99d2a..732d36a 100644 --- a/sidebars/widgets.php +++ b/sidebars/widgets.php @@ -109,4 +109,58 @@ add_action( 'widgets_init', 'register_stars' ); function register_stars() { register_widget( 'Widget_Stars' ); +} + +# corso base +class Widget_Brera extends WP_Widget { + + /** Registrazione del widget */ + public function __construct() { + parent::__construct( + 'widget_brera', // Base ID + 'Widget Brera', // Name + array( 'description' => __( 'Widget per l\'inserimento della sidebar del corso base di astronomia', 'text_domain' ), ) // Args + ); + } + + /** Front-end del widget */ + public function widget( $args, $instance ) { + extract( $args ); + $shortcode = do_shortcode('[sbcorsobase]'); + echo $shortcode; + echo $menu; + echo $after_widget; + } + + /** Back-end del widget */ + public function form( $instance ) { + if ( isset( $instance[ 'title' ] ) ) { + $title = $instance[ 'title' ]; + } + else { + $title = __( 'Titolo', 'text_domain' ); + } + ?> +

+ + +

+