'appetizo_latest_news_widget', 'description' => __('A post widget that can display your latest posts, posts from a category, or hand-picked posts by ID.', 'appetizo') ); /* Widget control settings. */ $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => 'appetizo_latest_news_widget' ); /* Create the widget. */ parent::__construct( 'appetizo_latest_news_widget', __('Appetizo: Post Widget', 'appetizo'), $widget_ops, $control_ops ); } /** * How to display the widget on the screen. */ function widget( $args, $instance ) { extract( $args ); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $layout = !empty($instance['layout']) ? $instance['layout'] : ''; $categories = !empty($instance['categories']) ? $instance['categories'] : ''; $number = !empty($instance['number']) ? $instance['number'] : ''; $counter = !empty($instance['counter']) ? $instance['counter'] : ''; $date = !empty($instance['date']) ? $instance['date'] : ''; $postids = !empty($instance['postids']) ? $instance['postids'] : ''; if($postids) { $postids = explode(',', $postids); $args_posts = array( 'showposts' => $number, 'post_type' => array('post', 'page'), 'post__in' => $postids, 'orderby' => 'post__in', 'ignore_sticky_posts' => 1 ); } else { $args_posts = array( 'showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'cat' => $categories ); } $loop = new WP_Query($args_posts); if ($loop->have_posts()) : $number_count = 0; /* Before widget (defined by themes). */ echo wp_kses_post( $args['before_widget'] ); /* Display the widget title if one was input (before and after defined by themes). */ if ( $title ) { echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] ); } ?> have_posts()) : $loop->the_post(); ?>

<?php esc_attr_e('Default', 'appetizo'); ?>

__('Latest Posts', 'appetizo'), 'number' => 3, 'categories' => '', 'layout' => '', 'date' => false, 'counter' => false, 'postids' => ''); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

/>

/>