'mh_slider_hp', 'description' => esc_html__('Slider widget for use on homepage template.', 'mh-magazine-lite') ) ); } function widget($args, $instance) { $defaults = array('category' => 0, 'tags' => '', 'postcount' => 5, 'offset' => 0, 'image_size' => 'large', 'sticky' => 1); $instance = wp_parse_args($instance, $defaults); $query_args = array(); if (0 !== $instance['category']) { $query_args['cat'] = $instance['category']; } if (!empty($instance['tags'])) { $tag_slugs = explode(',', $instance['tags']); $tag_slugs = array_map('trim', $tag_slugs); $query_args['tag_slug__in'] = $tag_slugs; } if (!empty($instance['postcount'])) { $query_args['posts_per_page'] = $instance['postcount']; } if (0 !== $instance['offset']) { $query_args['offset'] = $instance['offset']; } if (1 === $instance['sticky']) { $query_args['ignore_sticky_posts'] = true; } $slider_loop = new WP_Query($query_args); echo $args['before_widget']; ?>
50) { $instance['postcount'] = 50; } else { $instance['postcount'] = absint($new_instance['postcount']); } } if (0 !== absint($new_instance['offset'])) { if (absint($new_instance['offset']) > 50) { $instance['offset'] = 50; } else { $instance['offset'] = absint($new_instance['offset']); } } if ('large' !== $new_instance['image_size']) { if (in_array($new_instance['image_size'], array('normal'))) { $instance['image_size'] = $new_instance['image_size']; } } $instance['sticky'] = (!empty($new_instance['sticky'])) ? 1 : 0; return $instance; } function form($instance) { $defaults = array('category' => 0, 'tags' => '', 'postcount' => 5, 'offset' => 0, 'image_size' => 'large', 'sticky' => 1); $instance = wp_parse_args($instance, $defaults); ?>

/>