'education_master_featured_posts', 'description' => __( 'Displays featured posts from selected categories in different layouts.', 'education-master' ) ); parent::__construct( 'education_master_featured_posts', __( 'Featured Posts', 'education-master' ), $widget_ops ); } /** * Helper function that holds widget fields * Array is used in update and form functions */ private function widget_fields() { $education_master_categories_lists = education_master_categories_lists(); $fields = array( 'block_title' => array( 'education_master_widgets_name' => 'block_title', 'education_master_widgets_title' => __( 'Block title', 'education-master' ), 'education_master_widgets_description' => __( 'Enter your block title. (Optional - Leave blank to hide title.)', 'education-master' ), 'education_master_widgets_field_type' => 'text' ), 'block_cat_ids' => array( 'education_master_widgets_name' => 'block_cat_ids', 'education_master_widgets_title' => __( 'Block Categories', 'education-master' ), 'education_master_widgets_field_type' => 'multicheckboxes', 'education_master_widgets_field_options' => $education_master_categories_lists ) ); return $fields; } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { extract( $args ); if( empty( $instance ) ) { return ; } $education_master_block_title = empty( $instance['block_title'] ) ? '' : $instance['block_title']; $education_master_block_cat_ids = empty( $instance['block_cat_ids'] ) ? '' : $instance['block_cat_ids']; echo $before_widget; ?>