'vmagazine_lite_tab_posts_list', 'description' => esc_html__( 'Display fullwidth slider with .', 'vmagazine-lite' ) ); $width = array( 'width' => 600 ); parent::__construct( 'vmagazine_lite_tab_posts_list', esc_html__( 'Vmagazine-Lite: Fullwidth slider', '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_posts_type, $vmagazine_cat_dropdown; $fields = array( 'block_post_layout' => array( 'vmagazine_widgets_name' => 'block_post_layout', 'vmagazine_widgets_title' => esc_html__( 'Layout will be like this', 'vmagazine-lite' ), 'vmagazine_widgets_layout_img' => VMAG_WIDGET_IMG_URI.'fws-2.png', 'vmagazine_widgets_field_type' => 'widget_layout_image' ), '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_post_category' => array( 'vmagazine_widgets_name' => 'block_post_category', 'vmagazine_widgets_title' => esc_html__( 'Category for Block Posts', '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' ), 'block_section_meta' => array( 'vmagazine_widgets_name' => 'block_section_meta', 'vmagazine_widgets_title' => esc_html__( 'Hide/Show Meta', 'vmagazine-lite' ), 'vmagazine_widgets_default'=>'show', 'vmagazine_widgets_field_options'=>array('show'=>'Show','hide'=>'Hide'), 'vmagazine_widgets_field_type' => 'switch', 'vmagazine_widgets_description' => esc_html__('Show or hide post meta options like author name, post date etc','vmagazine-lite'), ), ); 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_posts_count = empty($instance['block_posts_count']) ? 4 : $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_post_category']) ? null: $instance['block_post_category']; $block_section_meta = empty($instance['block_section_meta']) ? 'show' : $instance['block_section_meta']; echo wp_kses_post($before_widget); ?>
have_posts() ) { while( $block_query->have_posts() ) { $block_query->the_post(); $image_id = get_post_thumbnail_id(); $img_src = vmagazine_lite_home_element_img('vmagazine-single-large'); $image_alt = get_post_meta( $image_id, '_wp_attachment_image_alt', true ); ?>
<?php echo esc_attr( $image_alt ); ?>

have_posts() ) { while( $block_query->have_posts() ) { $block_query->the_post(); $image_id = get_post_thumbnail_id(); $img_srcs = vmagazine_lite_home_element_img('vmagazine-small-thumb'); $image_alt = get_post_meta( $image_id, '_wp_attachment_image_alt', true ); ?>
<?php echo esc_attr( $image_alt ); ?>
'.esc_html($posted_on) .''; endif; ?>

widget_fields(); // Loop through fields foreach ( $widget_fields as $widget_field ) { extract( $widget_field ); // Use helper function to get updated field values $instance[$vmagazine_widgets_name] = vmagazine_lite_widgets_updated_field_value( $widget_field, $new_instance[$vmagazine_widgets_name] ); } return $instance; } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. * * @uses vmagazine_lite_widgets_show_widget_field() defined in vmagazine-widget-fields.php */ public function form( $instance ) { $widget_fields = $this->widget_fields(); // Loop through fields foreach ( $widget_fields as $widget_field ) { // Make array elements available as variables extract( $widget_field ); $vmagazine_widgets_field_value = !empty( $instance[$vmagazine_widgets_name]) ? esc_attr($instance[$vmagazine_widgets_name] ) : ''; vmagazine_lite_widgets_show_widget_field( $this, $widget_field, $vmagazine_widgets_field_value ); } } }