'WeaverSS_Widget_Slider',
'description' => esc_html__('Show Posts in a widget','show-posts' /*adm*/));
$control_ops = array('width' => 400, 'height' => 350);
parent::__construct('wvr_showposts', esc_html__('Weaver Show Posts','show-posts' /*adm*/), $widget_ops, $control_ops);
}
function widget($args, $instance) {
// Get menu
$instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
$post_list = $instance['post_list'];
if (!$post_list) $post_list = 'default';
$add_class = $instance['add_class'];
if (!$add_class) $add_class ='';
echo wp_kses_post($args['before_widget']);
if ( !empty($instance['title']) )
echo wp_kses_post($args['before_title']) . esc_html($instance['title']) . wp_kses_post($args['after_title']);
$before = $add_class ? "
" : '';
$after = $add_class ? "
" : '';
require_once(dirname( __FILE__ ) . '/atw-showposts-sc.php');
echo wp_kses_post($before) . wp_kses_post(atw_show_posts_shortcode( array('filter' => $post_list) )) . wp_kses_post($after);
echo wp_kses_post($args['after_widget']);
}
function update( $new_instance, $old_instance ) {
$instance['title'] = wp_strip_all_tags( stripslashes($new_instance['title']) );
$instance['post_list'] = $new_instance['post_list'];
$instance['add_class'] = wp_strip_all_tags( stripslashes($new_instance['add_class']) );
return $instance;
}
function form( $instance ) {
$title = isset( $instance['title'] ) ? $instance['title'] : '';
$post_list = isset( $instance['post_list'] ) ? $instance['post_list'] : 'default';
$add_class = isset( $instance['add_class'] ) ? $instance['add_class'] : '';
// Get posts
$posts = atw_posts_getopt('filters');
// If no menus exists, direct the user to go and create some.
if ( empty($posts) ) {
echo '' . 'No Post Filters have been created yet. Create some on the Weaver Posts (& Slider Options) -> Filters admin menu.' .'
';
return;
}
?>