* @package AnsPress/AP_Related_questions */ /** * Extend WP_Widget. */ class AP_Related_questions extends WP_Widget { /** * Initialize the class */ public function __construct() { parent::__construct( 'ap_related_questions', __( '(AnsPress) Related Questions', 'ap' ), array( 'description' => __( 'For showing related question. This widget will only work in question page.', 'ap' ) ) ); } public function widget( $args, $instance ) { global $questions; $title = apply_filters( 'widget_title', $instance['title'] ); echo $args['before_widget']; if ( ! empty( $title ) ) { echo $args['before_title'] . $title . $args['after_title']; } echo '
'; echo $args['after_widget']; } public function form( $instance ) { $title = __( 'Related Questions', 'ap' ); if ( isset( $instance[ 'title' ] ) ) { $title = $instance[ 'title' ]; } ?>