function form($instance) { // Parse $instance $instance_defaults = $this->defaults; $instance = wp_parse_args($instance, $instance_defaults); extract($instance, EXTR_SKIP); // $instance Defaults $show_date = isset($instance['show_date']) ? (bool) $instance['show_date'] : false; $show_cat = isset($instance['show_cat']) ? (bool) $instance['show_cat'] : false; $show_com = isset($instance['show_com']) ? (bool) $instance['show_com'] : false; $show_auth = isset($instance['show_auth']) ? (bool) $instance['show_auth'] : false; $show_excerpt = isset($instance['show_excerpt']) ? (bool) $instance['show_excerpt'] : false; $css_nmt = isset($instance['css_no_mt']) ? (bool) $instance['css_no_mt'] : false; $css_nmb = isset($instance['css_no_mb']) ? (bool) $instance['css_no_mb'] : false; $css_bot = isset($instance['css_b_top']) ? (bool) $instance['css_b_top'] : false; $css_bob = isset($instance['css_b_bot']) ? (bool) $instance['css_b_bot'] : false; $css_pat = isset($instance['css_p_top']) ? (bool) $instance['css_p_top'] : false; ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php esc_html_e('Section title:', 'justwrite'); ?> </label> <input class="widefat ac-builder-widget-title" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($instance['title']); ?> "/> </p> <?php $protitle = esc_html__('Pro Features', 'justwrite'); $getpro = esc_html__('Upgrade Now', 'justwrite'); $asdf = esc_html__('to enable them + many more', 'justwrite'); $lines = array(esc_html__('Some options are disabled:', 'justwrite'), esc_html__('- Show excerpt;', 'justwrite'), esc_html__('- Offset number;', 'justwrite')); parent::ac_promo_info($lines, $protitle, $getpro, $asdf); ?> <p> <label for="<?php echo $this->get_field_id('typeselect'); ?> "><?php _e('Display:', 'justwrite'); ?> </label> <select name="<?php echo $this->get_field_name('typeselect'); ?> " id="<?php echo $this->get_field_id('typeselect'); ?> " class="widefat ac-select-type"> <option value="featured"<?php selected($instance['typeselect'], 'featured'); ?> ><?php _e('Featured posts', 'justwrite'); ?> </option> <option value="posts"<?php selected($instance['typeselect'], 'posts'); ?> ><?php _e('Latest posts', 'justwrite'); ?> </option> <option value="category"<?php selected($instance['typeselect'], 'category'); ?> ><?php _e('Category posts', 'justwrite'); ?> </option> </select> </p> <p class="ac-display-category-field" style="display: none;"> <label for="<?php echo $this->get_field_id('category'); ?> "><?php esc_html_e('Select a category:', 'justwrite'); ?> </label> <?php wp_dropdown_categories(array('orderby' => 'title', 'hide_empty' => true, 'name' => $this->get_field_name('category'), 'id' => $this->get_field_id('category'), 'class' => 'widefat', 'selected' => $instance['category'])); ?> </p> <p> <label for="<?php echo $this->get_field_id('posts_nr'); ?> "><?php esc_html_e('Number of posts (more than 3):', 'justwrite'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('posts_nr'); ?> " name="<?php echo $this->get_field_name('posts_nr'); ?> " type="text" value="<?php echo esc_attr($instance['posts_nr']); ?> "/> </p> <p> <label for="<?php echo $this->get_field_id('offset'); ?> "><?php esc_html_e('Offset (number of posts to "displace" or pass over):', 'justwrite'); ?> </label> <input disabled class="widefat" id="<?php echo $this->get_field_id('offset'); ?> " name="<?php echo $this->get_field_name('offset'); ?> " type="text" value="<?php echo esc_attr($instance['offset']); ?> "/> </p> <p> <b><?php _e('Display options:', 'justwrite'); ?> </b><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_date'); ?> " name="<?php echo $this->get_field_name('show_date'); ?> "<?php checked($show_date); ?> /> <label for="<?php echo $this->get_field_id('show_date'); ?> "><?php _e('Show date', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_cat'); ?> " name="<?php echo $this->get_field_name('show_cat'); ?> "<?php checked($show_cat); ?> /> <label for="<?php echo $this->get_field_id('show_cat'); ?> "><?php _e('Show category', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_auth'); ?> " name="<?php echo $this->get_field_name('show_auth'); ?> "<?php checked($show_auth); ?> /> <label for="<?php echo $this->get_field_id('show_auth'); ?> "><?php _e('Show author', 'justwrite'); ?> </label><br /> <input disabled type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_excerpt'); ?> " name="<?php echo $this->get_field_name('show_excerpt'); ?> "<?php checked($show_excerpt); ?> /> <label for="<?php echo $this->get_field_id('show_excerpt'); ?> "><?php _e('Show excerpt', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_com'); ?> " name="<?php echo $this->get_field_name('show_com'); ?> "<?php checked($show_com); ?> /> <label for="<?php echo $this->get_field_id('show_com'); ?> "><?php _e('Show # comments', 'justwrite'); ?> </label> </p> <p> <b><?php _e('Styling options:', 'justwrite'); ?> </b><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('css_no_mt'); ?> " name="<?php echo $this->get_field_name('css_no_mt'); ?> "<?php checked($css_nmt); ?> /> <label for="<?php echo $this->get_field_id('css_no_mt'); ?> "><?php _e('Remove top margin', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('css_no_mb'); ?> " name="<?php echo $this->get_field_name('css_no_mb'); ?> "<?php checked($css_nmb); ?> /> <label for="<?php echo $this->get_field_id('css_no_mb'); ?> "><?php _e('Remove bottom margin', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('css_b_top'); ?> " name="<?php echo $this->get_field_name('css_b_top'); ?> "<?php checked($css_bot); ?> /> <label for="<?php echo $this->get_field_id('css_b_top'); ?> "><?php _e('Add border top', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('css_b_bot'); ?> " name="<?php echo $this->get_field_name('css_b_bot'); ?> "<?php checked($css_bob); ?> /> <label for="<?php echo $this->get_field_id('css_b_bot'); ?> "><?php _e('Add border bottom', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('css_p_top'); ?> " name="<?php echo $this->get_field_name('css_p_top'); ?> "<?php checked($css_pat); ?> /> <label for="<?php echo $this->get_field_id('css_p_top'); ?> "><?php _e('Add padding top', 'justwrite'); ?> </label> </p> <?php }
function form($instance) { // Parse $instance $instance_defaults = $this->defaults; $instance = wp_parse_args($instance, $instance_defaults); extract($instance, EXTR_SKIP); // $instance Defaults $show_more = isset($instance['show_more']) ? (bool) $instance['show_more'] : false; $show_rss = isset($instance['show_rss']) ? (bool) $instance['show_rss'] : false; $show_date = isset($instance['show_date']) ? (bool) $instance['show_date'] : false; $show_coms = isset($instance['show_coms']) ? (bool) $instance['show_coms'] : false; $show_auth = isset($instance['show_auth']) ? (bool) $instance['show_auth'] : false; $css_nmt = isset($instance['css_no_mt']) ? (bool) $instance['css_no_mt'] : false; $css_nmb = isset($instance['css_no_mb']) ? (bool) $instance['css_no_mb'] : false; $css_bot = isset($instance['css_b_top']) ? (bool) $instance['css_b_top'] : false; $css_bob = isset($instance['css_b_bot']) ? (bool) $instance['css_b_bot'] : false; $css_pat = isset($instance['css_p_top']) ? (bool) $instance['css_p_top'] : false; ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php esc_html_e('Section title:', 'justwrite'); ?> </label> <input class="widefat ac-builder-widget-title" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($instance['title']); ?> "/> </p> <?php $protitle = esc_html__('Pro Features', 'justwrite'); $getpro = esc_html__('Upgrade Now', 'justwrite'); $asdf = esc_html__('to enable them + many more', 'justwrite'); $lines = array(esc_html__('Some options are disabled:', 'justwrite'), esc_html__('- Offset number;', 'justwrite')); parent::ac_promo_info($lines, $protitle, $getpro, $asdf); ?> <p> <label for="<?php echo $this->get_field_id('category_1'); ?> "><?php esc_html_e('1st column category', 'justwrite'); ?> </label> <?php wp_dropdown_categories(array('orderby' => 'title', 'hide_empty' => true, 'name' => $this->get_field_name('category_1'), 'id' => $this->get_field_id('category_1'), 'class' => 'widefat', 'selected' => $instance['category_1'])); ?> </p> <p> <label for="<?php echo $this->get_field_id('category_2'); ?> "><?php esc_html_e('2nd column category', 'justwrite'); ?> </label> <?php wp_dropdown_categories(array('orderby' => 'title', 'hide_empty' => true, 'name' => $this->get_field_name('category_2'), 'id' => $this->get_field_id('category_2'), 'class' => 'widefat', 'selected' => $instance['category_2'])); ?> </p> <p> <label for="<?php echo $this->get_field_id('category_3'); ?> "><?php esc_html_e('3rd column category', 'justwrite'); ?> </label> <?php wp_dropdown_categories(array('orderby' => 'title', 'hide_empty' => true, 'name' => $this->get_field_name('category_3'), 'id' => $this->get_field_id('category_3'), 'class' => 'widefat', 'selected' => $instance['category_3'])); ?> </p> <p> <label for="<?php echo $this->get_field_id('category_4'); ?> "><?php esc_html_e('4th column category', 'justwrite'); ?> </label> <?php wp_dropdown_categories(array('orderby' => 'title', 'hide_empty' => true, 'name' => $this->get_field_name('category_4'), 'id' => $this->get_field_id('category_4'), 'class' => 'widefat', 'selected' => $instance['category_4'])); ?> </p> <p> <label for="<?php echo $this->get_field_id('posts_nr'); ?> "><?php esc_html_e('Number of posts (3 or more):', 'justwrite'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('posts_nr'); ?> " name="<?php echo $this->get_field_name('posts_nr'); ?> " type="text" value="<?php echo esc_attr($instance['posts_nr']); ?> "/> </p> <p> <label for="<?php echo $this->get_field_id('offset'); ?> "><?php esc_html_e('Offset (number of posts to "displace" or pass over):', 'justwrite'); ?> </label> <input disabled class="widefat" id="<?php echo $this->get_field_id('offset'); ?> " name="<?php echo $this->get_field_name('offset'); ?> " type="text" value="<?php echo esc_attr($instance['offset']); ?> "/> </p> <p> <b><?php _e('Display options:', 'justwrite'); ?> </b><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_more'); ?> " name="<?php echo $this->get_field_name('show_more'); ?> "<?php checked($show_more); ?> /> <label for="<?php echo $this->get_field_id('show_more'); ?> "><?php _e('Show "More Articles" button', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_rss'); ?> " name="<?php echo $this->get_field_name('show_rss'); ?> "<?php checked($show_rss); ?> /> <label for="<?php echo $this->get_field_id('show_rss'); ?> "><?php _e('Show "RSS" button', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_date'); ?> " name="<?php echo $this->get_field_name('show_date'); ?> "<?php checked($show_date); ?> /> <label for="<?php echo $this->get_field_id('show_date'); ?> "><?php _e('Show date', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_auth'); ?> " name="<?php echo $this->get_field_name('show_auth'); ?> "<?php checked($show_auth); ?> /> <label for="<?php echo $this->get_field_id('show_auth'); ?> "><?php _e('Show author', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_coms'); ?> " name="<?php echo $this->get_field_name('show_coms'); ?> "<?php checked($show_coms); ?> /> <label for="<?php echo $this->get_field_id('show_coms'); ?> "><?php _e('Show comments number', 'justwrite'); ?> </label> </p> <p> <b><?php _e('Styling options:', 'justwrite'); ?> </b><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('css_no_mt'); ?> " name="<?php echo $this->get_field_name('css_no_mt'); ?> "<?php checked($css_nmt); ?> /> <label for="<?php echo $this->get_field_id('css_no_mt'); ?> "><?php _e('Remove top margin', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('css_no_mb'); ?> " name="<?php echo $this->get_field_name('css_no_mb'); ?> "<?php checked($css_nmb); ?> /> <label for="<?php echo $this->get_field_id('css_no_mb'); ?> "><?php _e('Remove bottom margin', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('css_b_top'); ?> " name="<?php echo $this->get_field_name('css_b_top'); ?> "<?php checked($css_bot); ?> /> <label for="<?php echo $this->get_field_id('css_b_top'); ?> "><?php _e('Add border top', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('css_b_bot'); ?> " name="<?php echo $this->get_field_name('css_b_bot'); ?> "<?php checked($css_bob); ?> /> <label for="<?php echo $this->get_field_id('css_b_bot'); ?> "><?php _e('Add border bottom', 'justwrite'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('css_p_top'); ?> " name="<?php echo $this->get_field_name('css_p_top'); ?> "<?php checked($css_pat); ?> /> <label for="<?php echo $this->get_field_id('css_p_top'); ?> "><?php _e('Add padding top', 'justwrite'); ?> </label> </p> <?php }