text_fields = array('magnitude-categorised-posts-title', 'magnitude-posts-number'); $this->select_fields = array('magnitude-select-category', 'magnitude-show-category'); $widget_ops = array( 'classname' => 'magnitude_posts_list list-layout', 'description' => __('Displays posts from selected category in a list.', 'magnitude'), 'customize_selective_refresh' => false, ); parent::__construct('magnitude_posts_list', __('AFTM Posts List', 'magnitude'), $widget_ops); } /** * 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) { $instance = parent::magnitude_sanitize_data($instance, $instance); /** This filter is documented in wp-includes/default-widgets.php */ $title = apply_filters('widget_title', $instance['magnitude-categorised-posts-title'], $instance, $this->id_base); $category = isset($instance['magnitude-select-category']) ? $instance['magnitude-select-category'] : '0'; $show_categories = isset($instance['magnitude-show-category']) ? $instance['magnitude-show-category'] : 'true'; // open the widget container echo $args['before_widget']; ?>

have_posts()) : while ($all_posts->have_posts()) : $all_posts->the_post(); global $post; $thumbnail_size = 'thumbnail'; ?>
form_instance = $instance; $categories = magnitude_get_terms(); if (isset($categories) && !empty($categories)) { // generate the text input for the title of the widget. Note that the first parameter matches text_fields array entry echo parent::magnitude_generate_text_input('magnitude-categorised-posts-title', __('Title', 'magnitude'), __('Posts List', 'magnitude')); echo parent::magnitude_generate_select_options('magnitude-select-category', __('Select category', 'magnitude'), $categories); } //print_pre($terms); } } endif;