'vmagazine_lite_cat_tabbed_ajax', 'description' => __( 'Display posts from selected category as tabbed sytles.', 'vmagazine-lite' ) ); $width = array( 'width' => 600 ); parent::__construct( 'vmagazine_lite_cat_tabbed_ajax', esc_html__( 'Vmagazine-Lite : Multiple Category Tabbed', 'vmagazine-lite' ), $widget_ops, $width ); } /** * Helper function that holds widget fields * Array is used in update and form functions */ private function widget_fields() { global $vmagazine_cat_dropdown,$vmagazine_posts_type; $fields = array( 'block_layout' => array( 'vmagazine_widgets_name' => 'block_layout', 'vmagazine_widgets_title' => esc_html__( 'Layout will be like this', 'vmagazine-lite' ), 'vmagazine_widgets_layout_img' => VMAG_WIDGET_IMG_URI.'mct.png', 'vmagazine_widgets_field_type' => 'widget_layout_image' ), 'block_title' => array( 'vmagazine_widgets_name' => 'block_title', 'vmagazine_widgets_title' => esc_html__( 'Block Title', 'vmagazine-lite' ), 'vmagazine_widgets_field_type' => 'text' ), 'block_post_type' => array( 'vmagazine_widgets_name' => 'block_post_type', 'vmagazine_widgets_title' => esc_html__( 'Block Display Type', 'vmagazine-lite' ), 'vmagazine_widgets_field_type' => 'radio', 'vmagazine_widgets_default' => 'latest_posts', 'vmagazine_widgets_field_options' => $vmagazine_posts_type ), 'block_single_cats' => array( 'vmagazine_widgets_name' => 'block_single_cats', 'vmagazine_widgets_title' => esc_html__( 'Choose categories', 'vmagazine-lite' ), 'vmagazine_widgets_default' => 0, 'vmagazine_widgets_field_type' => 'select', 'vmagazine_widgets_field_options' => $vmagazine_cat_dropdown ), 'block_section_excerpt' => array( 'vmagazine_widgets_name' => 'block_section_excerpt', 'vmagazine_widgets_title' => esc_html__( 'Excerpt for post description', 'vmagazine-lite' ), 'vmagazine_widgets_description' => esc_html__( 'Enter Excerpts in number of letters default: 200', 'vmagazine-lite' ), 'vmagazine_widgets_field_type' => 'number', 'vmagazine_widgets_default' => 200 ), 'block_view_all_text' => array( 'vmagazine_widgets_name' => 'block_view_all_text', 'vmagazine_widgets_title' => esc_html__( 'View All Text', 'vmagazine-lite' ), 'vmagazine_widgets_field_type' => 'text', ), 'block_section_meta' => array( 'vmagazine_widgets_name' => 'block_section_meta', 'vmagazine_widgets_title' => esc_html__( 'Hide/Show Meta Description', 'vmagazine-lite' ), 'vmagazine_widgets_default'=>'show', 'vmagazine_widgets_field_options'=>array('show'=>'Show','hide'=>'Hide'), 'vmagazine_widgets_field_type' => 'switch' ), ); 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 ; } $vmagazine_block_title = empty( $instance['block_title'] ) ? '' : $instance['block_title']; $vmagazine_block_posts_count = 7; $vmagazine_block_posts_type = empty($instance['block_post_type']) ? 'latest_posts' : $instance['block_post_type']; $block_section_excerpt = empty($instance['block_section_excerpt']) ? '' :$instance['block_section_excerpt']; $vmagazine_block_cat_id = empty($instance['block_post_category']) ? null: $instance['block_post_category']; $vmagazine_block_single_cats = empty( $instance['block_single_cats'] ) ? null : $instance['block_single_cats']; $block_view_all_text = isset( $instance['block_view_all_text'] ) ? $instance['block_view_all_text'] : ''; $block_section_meta = isset( $instance['block_section_meta'] ) ? $instance['block_section_meta'] : 'show'; echo wp_kses_post($before_widget); ?>