function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'count' => '', 'cat' => '', 'excerpt' => '')); $title = strip_tags($instance['title']); $count = strip_tags($instance['count']); $excerpt = strip_tags($instance['excerpt']); $elementCat = array("name" => "Which categories should be used for the portfolio?", "desc" => "You can select multiple categories here", "id" => $this->get_field_name('cat') . "[]", "type" => "select", "std" => strip_tags($instance['cat']), "class" => "", "multiple" => 6, "subtype" => "cat"); //check if a different taxonomy than the default is set if (!empty($this->avia_term)) { $elementCat['taxonomy'] = $this->avia_term; } $html = new avia_htmlhelper(); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> ">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /></label></p> <p> <label for="<?php echo $this->get_field_id('count'); ?> ">How many entries do you want to display: </label> <select class="widefat" id="<?php echo $this->get_field_id('count'); ?> " name="<?php echo $this->get_field_name('count'); ?> "> <?php $list = ""; for ($i = 1; $i <= 20; $i++) { $selected = ""; if ($count == $i) { $selected = 'selected="selected"'; } $list .= "<option {$selected} value='{$i}'>{$i}</option>"; } $list .= "</select>"; echo $list; ?> </p> <p><label for="<?php echo $this->get_field_id('cat'); ?> ">Choose the categories you want to display (multiple selection possible): <?php echo $html->select($elementCat); ?> </label></p> <p> <label for="<?php echo $this->get_field_id('excerpt'); ?> ">Display title only or title & excerpt</label> <select class="widefat" id="<?php echo $this->get_field_id('excerpt'); ?> " name="<?php echo $this->get_field_name('excerpt'); ?> "> <?php $list = ""; $answers = array('show title only', 'display title and excerpt'); foreach ($answers as $answer) { $selected = ""; if ($answer == $excerpt) { $selected = 'selected="selected"'; } $list .= "<option {$selected} value='{$answer}'>{$answer}</option>"; } $list .= "</select>"; echo $list; ?> </p> <?php }