esc_html__('This Widget show masonry_post', 'buzmag') ) ); } /** * Helper function that holds widget fields * Array is used in update and form functions */ private function widget_fields() { $buzmag_cat_list[''] = esc_html__('--Choose--','buzmag'); $buzmag_cat_list = buzmag_Category_list(); $fields = array( 'bm_masonry_post_title' => array( 'buzmag_widgets_name' => 'bm_masonry_post_title', 'buzmag_widgets_title' => esc_html__('Masonory Secction Title', 'buzmag'), 'buzmag_widgets_field_type' => 'text', ), 'bm_masonry_post_category' => array( 'buzmag_widgets_name' => 'bm_masonry_post_category', 'buzmag_widgets_title' => esc_html__('Select Products Categorys', 'buzmag'), 'buzmag_widgets_field_type' => 'multicheckboxes', 'buzmag_widgets_field_options' => $buzmag_cat_list ), 'bm_masonry_post_posts' => array( 'buzmag_widgets_name' => 'bm_masonry_post_posts', 'buzmag_widgets_title' => esc_html__('Masonry Posts Number', 'buzmag'), 'buzmag_widgets_field_type' => 'number', ), ); 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); $bm_masonry_post_category_list = isset( $instance['bm_masonry_post_category'] ) ? $instance['bm_masonry_post_category'] : '' ; $bm_masonry_post_title = apply_filters( 'widget_title', empty( $instance['bm_masonry_post_title'] ) ? '' : $instance['bm_masonry_post_title'], $instance, $this->id_base ); $bm_masonry_post_posts = isset( $instance['bm_masonry_post_posts'] ) ? $instance['bm_masonry_post_posts'] : '' ; if($bm_masonry_post_posts == ''){ $bm_masonry_post_posts = -1; } echo $before_widget;?>