webinars
class Custom_Widget_webinars extends WP_Widget {
public function __construct() {
parent::__construct(
'widget_webinar',
__( 'Webinars', 'text_domain' ),
array(
'description' => __( 'select webinars', 'text_domain' ),
'classname' => 'widget class',
)
);
}
public function widget( $args, $instance ) {
echo $web
}
public function form( $instance ) {
// Set default values
$instance = wp_parse_args( (array) $instance, array(
'custom_webinarfuture_webinars' => '2',
'custom_webinarpast_webinars' => '2',
) );
// Retrieve an existing value from the database
$custom_webinarfuture_webinars = !empty( $instance['custom_webinarfuture_webinars'] ) ? $instance['custom_webinarfuture_webinars'] : '';
$custom_webinarpast_webinars = !empty( $instance['custom_webinarpast_webinars'] ) ? $instance['custom_webinarpast_webinars'] : '';
// Form fields
echo '<p>';
echo ' <label for="' . $this->get_field_id( 'custom_webinarfuture_webinars' ) . '" class="custom_webinarfuture_webinars_label">' . __( 'Future', 'text_domain' ) . '</label>';
echo ' <input type="number" id="' . $this->get_field_id( 'custom_webinarfuture_webinars' ) . '" name="' . $this->get_field_name( 'custom_webinarfuture_webinars' ) . '" class="widefat" placeholder="' . esc_attr__( '', 'text_domain' ) . '" value="' . esc_attr( $custom_webinarfuture_webinars ) . '">';
echo ' <span class="description">' . __( 'number of future webinars', 'text_domain' ) . '</span>';
echo '</p>';
echo '<p>';
echo ' <label for="' . $this->get_field_id( 'custom_webinarpast_webinars' ) . '" class="custom_webinarpast_webinars_label">' . __( 'Past', 'text_domain' ) . '</label>';
echo ' <input type="number" id="' . $this->get_field_id( 'custom_webinarpast_webinars' ) . '" name="' . $this->get_field_name( 'custom_webinarpast_webinars' ) . '" class="widefat" placeholder="' . esc_attr__( '', 'text_domain' ) . '" value="' . esc_attr( $custom_webinarpast_webinars ) . '">';
echo ' <span class="description">' . __( 'past', 'text_domain' ) . '</span>';
echo '</p>';
}
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['custom_webinarfuture_webinars'] = !empty( $new_instance['custom_webinarfuture_webinars'] ) ? strip_tags( $new_instance['custom_webinarfuture_webinars'] ) : '';
$instance['custom_webinarpast_webinars'] = !empty( $new_instance['custom_webinarpast_webinars'] ) ? strip_tags( $new_instance['custom_webinarpast_webinars'] ) : '';
return $instance;
}
}
function custom_webinarregister_widgets() {
register_widget( 'Custom_Widget_webinars' );
}
add_action( 'widgets_init', 'custom_webinarregister_widgets' );