'vmagazine_lite_category_slider_tab_carousel', 'description' => esc_html__( 'Display posts from selected category as slider in Tab.', 'vmagazine-lite' ) ); $width = array( 'width' => 600 ); parent::__construct( 'vmagazine_lite_category_slider_tab_carousel', esc_html__( 'Vmagazine-Lite : Slider Tab Carousel', '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.'stc.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_cat' => array( 'vmagazine_widgets_name' => 'block_single_cat', '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_posts_count' => array( 'vmagazine_widgets_name' => 'block_posts_count', 'vmagazine_widgets_title' => esc_html__( 'No. of Posts', 'vmagazine-lite' ), 'vmagazine_widgets_default' => 4, 'vmagazine_widgets_field_type' => 'number' ), //design 'block_section_meta' => array( 'vmagazine_widgets_name' => 'block_section_meta', 'vmagazine_widgets_title' => esc_html__( 'Show/Hide Meta', 'vmagazine-lite' ), 'vmagazine_widgets_default'=>'show', 'vmagazine_widgets_field_options'=>array('show'=>'Show','hide'=>'Hide'), 'vmagazine_widgets_description' => esc_html__('Show or hide post meta options like author name, post date etc','vmagazine-lite'), '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 = empty( $instance['block_posts_count'] ) ? 6 : $instance['block_posts_count']; $vmagazine_block_posts_type = empty($instance['block_post_type']) ? 'latest_posts' : $instance['block_post_type']; $vmagazine_block_cat_id = empty($instance['block_single_cat']) ? null: $instance['block_single_cat']; $block_section_meta = isset( $instance['block_section_meta'] ) ? $instance['block_section_meta'] : 'show'; echo wp_kses_post($before_widget); ?>