function form($instance) { global $options; $instance = wp_parse_args((array) $instance, array('title' => '', 'cat' => '', 'number' => '3', 'length' => 25)); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $filter = isset($instance['filter']) ? $instance['filter'] : false; if (!isset($instance['number']) || !($number = (int) $instance['number'])) { $number = 3; } if (!isset($instance['length']) || !($length = (int) $instance['length'])) { $length = 25; } $width = isset($instance['width']) ? $instance['width'] : 'full'; ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title', 'wpsight'); ?> : <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('filter'); ?> "><?php _e('Filter', 'wpsight'); ?> :</label> <select class="widefat" id="<?php echo $this->get_field_id('filter'); ?> " name="<?php echo $this->get_field_name('filter'); ?> "> <option value="" <?php selected('', $filter); ?> ><?php _e('Latest properties', 'wpsight'); ?> </option> <option value="latest-sale" <?php selected('latest-sale', $filter); ?> ><?php _e('Latest properties (for sale)', 'wpsight'); ?> </option> <option value="latest-rent" <?php selected('latest-rent', $filter); ?> ><?php _e('Latest properties (for rent)', 'wpsight'); ?> </option> <option value="">--- <?php _e('Categories', 'wpsight'); ?> ---</option> <?php // Add property categories $terms_category = get_terms(array('property-category'), array('hide_empty' => 0)); foreach ($terms_category as $term) { echo '<option value="' . $term->taxonomy . ',' . $term->slug . '"' . selected($term->taxonomy . ',' . $term->slug, $filter) . '>' . $term->name . '</option>'; } ?> <option value="">--- <?php _e('Features', 'wpsight'); ?> ---</option> <?php // Add property features $terms_feature = get_terms(array('feature'), array('hide_empty' => 0)); foreach ($terms_feature as $term) { echo '<option value="' . $term->taxonomy . ',' . $term->slug . '"' . selected($term->taxonomy . ',' . $term->slug, $filter) . '>' . $term->name . '</option>'; } ?> <option value="">--- <?php _e('Locations', 'wpsight'); ?> ---</option> <?php // Add property features $terms_location = get_terms(array('location'), array('hide_empty' => 0)); foreach ($terms_location as $term) { echo '<option value="' . $term->taxonomy . ',' . $term->slug . '"' . selected($term->taxonomy . ',' . $term->slug, $filter) . '>' . $term->name . '</option>'; } ?> <option value="">--- <?php _e('Types', 'wpsight'); ?> ---</option> <?php // Add property features $terms_type = get_terms(array('property-type'), array('hide_empty' => 0)); foreach ($terms_type as $term) { echo '<option value="' . $term->taxonomy . ',' . $term->slug . '"' . selected($term->taxonomy . ',' . $term->slug, $filter) . '>' . $term->name . '</option>'; } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('number'); ?> "><?php _e('Number of posts to show', 'wpsight'); ?> :</label> <input id="<?php echo $this->get_field_id('number'); ?> " name="<?php echo $this->get_field_name('number'); ?> " type="text" value="<?php echo $number; ?> " size="3" /><br /><small><?php _e('(at most 20)', 'wpsight'); ?> </small> </p> <p> <label for="<?php echo $this->get_field_id('length'); ?> "><?php _e('Number of words in excerpt', 'wpsight'); ?> :</label> <input id="<?php echo $this->get_field_id('length'); ?> " name="<?php echo $this->get_field_name('length'); ?> " type="text" value="<?php echo $length; ?> " size="3" /> </p> <p> <label for="<?php echo $this->get_field_id('width'); ?> "><?php _e('Width', 'wpsight'); ?> :</label> <select class="widefat" id="<?php echo $this->get_field_id('width'); ?> " name="<?php echo $this->get_field_name('width'); ?> "> <?php foreach (wpsight_widget_widths() as $k => $v) { echo '<option value="' . $k . '"' . selected($k, $width, false) . '>' . $v . '</option>'; } ?> </select> </p><?php }
function form($instance) { $defaults = array('remove' => false, 'center' => false, 'link' => false, 'position' => false); $instance = wp_parse_args((array) $instance, $defaults); $icon = isset($instance['icon']) ? strip_tags($instance['icon']) : false; $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $image = isset($instance['image']) ? $instance['image'] : false; $imageurl = isset($instance['imageurl']) ? $instance['imageurl'] : false; $imagewidth = isset($instance['imagewidth']) ? $instance['imagewidth'] : false; $title_icon = isset($instance['title_icon']) ? strip_tags($instance['title_icon']) : false; $image_link = !empty($instance['image']) ? __('Change image', 'wpsight') : __('Add image', 'wpsight'); $size = isset($instance['size']) ? $instance['size'] : 'post-thumbnail'; $align = isset($instance['align']) ? $instance['align'] : 'none'; $text = isset($instance['text']) ? wp_kses_post($instance['text']) : false; $link_space = isset($instance['link_space']) ? strip_tags($instance['link_space']) : false; $width = isset($instance['width']) ? $instance['width'] : 'full'; ?> <p> <label for="<?php echo $this->get_field_id('icon'); ?> "><?php _e('Icon', 'wpsight'); ?> :</label><br /> <select class="widefat" id="<?php echo $this->get_field_id('icon'); ?> " name="<?php echo $this->get_field_name('icon'); ?> "> <option value=""<?php selected('icon', $icon); ?> ><?php _e('none', 'wpsight'); ?> </option> <?php foreach (wpsight_bootstrap_icons() as $k) { echo '<option value="' . $k . '"' . selected($k, $icon) . '>' . $k . '</option>'; } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title', 'wpsight'); ?> :</label><br /> <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); ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('title_icon'); ?> "><?php _e('Title Icon', 'wpsight'); ?> :</label><br /> <select class="widefat" id="<?php echo $this->get_field_id('title_icon'); ?> " name="<?php echo $this->get_field_name('title_icon'); ?> "> <option value=""<?php selected('title_icon', $title_icon); ?> ><?php _e('none', 'wpsight'); ?> </option> <?php foreach (wpsight_bootstrap_icons() as $k) { echo '<option value="' . $k . '"' . selected($k, $title_icon) . '>' . $k . '</option>'; } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('image'); ?> "><?php _e('Image', 'wpsight'); ?> :</label> </p> <p> <?php $media_upload_iframe_src = 'media-upload.php?type=image&widget_id=' . $this->id; $image_upload_iframe_src = apply_filters('image_upload_iframe_src', $media_upload_iframe_src); ?> <a href="<?php echo $image_upload_iframe_src; ?> &TB_iframe=true" id="add_image-<?php echo $this->get_field_id('image'); ?> " class="thickbox-image-widget" onClick="set_active_widget('<?php echo $this->id; ?> ');return false;"><?php echo $image_link; ?> </a> <div id="display-<?php echo $this->get_field_id('image'); ?> " class="wpsight-spaces-image<?php if (empty($instance['imageurl'])) { echo ' no-image'; } ?> "> <?php if ($imageurl) { if ($instance['size'] == 'custom') { echo "<img src=\"{$imageurl}\" alt=\"{$title}\" />"; } else { echo wp_get_attachment_image($image, 'post-thumbnail'); } } ?> </div> <input id="<?php echo $this->get_field_id('image'); ?> " name="<?php echo $this->get_field_name('image'); ?> " type="hidden" value="<?php echo $image; ?> " /> </p> <div id="settings-<?php echo $this->get_field_id('image'); ?> " class="<?php if (empty($imageurl)) { echo 'no-image'; } ?> "> <p> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('remove'); ?> " name="<?php echo $this->get_field_name('remove'); ?> " <?php checked($instance['remove'], true); ?> /> <label for="<?php echo $this->get_field_id('remove'); ?> "><?php _e('Remove image', 'wpsight'); ?> </label> </p> <p> <label for="<?php echo $this->get_field_id('size'); ?> "><?php _e('Image size', 'wpsight'); ?> :</label> <select class="widefat" id="<?php echo $this->get_field_id('size'); ?> " name="<?php echo $this->get_field_name('size'); ?> "> <option value="custom"<?php selected('custom', $size); ?> ><?php _e('custom', 'wpsight'); ?> </option> <?php foreach (wpsight_image_sizes() as $k => $v) { echo '<option value="' . $k . '"' . selected($k, $size) . '>' . $v['label'] . ' (' . $v['size']['w'] . 'x' . $v['size']['h'] . ')</option>'; } ?> </select><br /> <span class="description"<?php if ($size == 'custom') { echo ' style="display:none"'; } ?> ><?php _e('Image size is also limited by the box width you select below', 'wpsight'); ?> </span> </p> <div <?php if ($size != 'custom') { echo ' style="display:none"'; } ?> > <p> <label for="<?php echo $this->get_field_id('imagewidth'); ?> "><?php _e('Image width', 'wpsight'); ?> :</label><br /> <input class="widefat" id="<?php echo $this->get_field_id('imagewidth'); ?> " name="<?php echo $this->get_field_name('imagewidth'); ?> " type="text" value="<?php echo esc_attr(strip_tags($imagewidth)); ?> " onchange="changeImgWidth('<?php echo $this->id; ?> ')" /> <input id="<?php echo $this->get_field_id('height'); ?> " name="<?php echo $this->get_field_name('height'); ?> " type="hidden" value="<?php echo esc_attr(strip_tags($imagewidth)); ?> " onchange="changeImgHeight('<?php echo $this->id; ?> ')" /> </p> </div> <p> <label for="<?php echo $this->get_field_id('align'); ?> "><?php _e('Image align', 'wpsight'); ?> :</label> <select class="widefat" id="<?php echo $this->get_field_id('align'); ?> " name="<?php echo $this->get_field_name('align'); ?> "> <option value="none"<?php selected('none', $align); ?> ><?php _e('none', 'wpsight'); ?> </option> <option value="left"<?php selected('left', $align); ?> ><?php _e('left', 'wpsight'); ?> </option> <option value="right"<?php selected('right', $align); ?> ><?php _e('right', 'wpsight'); ?> </option> <option value="center"<?php selected('center', $align); ?> ><?php _e('center', 'wpsight'); ?> </option> </select> </p> <p> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('link'); ?> " name="<?php echo $this->get_field_name('link'); ?> " <?php checked($instance['link'], true); ?> /> <label for="<?php echo $this->get_field_id('link'); ?> "><?php _e('Link image', 'wpsight'); ?> </label><br /> <span class="description"><?php _e('Click on image opens lightbox', 'wpsight'); ?> </span> </p> </div> <p> <label for="<?php echo $this->get_field_id('text'); ?> "><?php _e('Text', 'wpsight'); ?> :</label> <textarea class="widefat" rows="10" cols="10" id="<?php echo $this->get_field_id('text'); ?> " name="<?php echo $this->get_field_name('text'); ?> "><?php echo esc_textarea($text); ?> </textarea><br /> </p> <p> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('center'); ?> " name="<?php echo $this->get_field_name('center'); ?> " <?php checked($instance['center'], true); ?> /> <label for="<?php echo $this->get_field_id('center'); ?> "><?php _e('Center widget content', 'wpsight'); ?> </label> </p> <p> <label for="<?php echo $this->get_field_id('link_space'); ?> "><?php _e('Link', 'wpsight'); ?> :</label> <input class="widefat" id="<?php echo $this->get_field_id('link_space'); ?> " name="<?php echo $this->get_field_name('link_space'); ?> " type="text" value="<?php echo esc_attr($link_space); ?> " /><br /> <span class="description"><?php _e('Adds links to title and image (enter a URL or post/page ID)', 'wpsight'); ?> </span> </p> <p> <label for="<?php echo $this->get_field_id('width'); ?> "><?php _e('Width', 'wpsight'); ?> :</label> <select class="widefat" id="<?php echo $this->get_field_id('width'); ?> " name="<?php echo $this->get_field_name('width'); ?> "> <?php foreach (wpsight_widget_widths() as $k => $v) { echo '<option value="' . $k . '"' . selected($k, $width, false) . '>' . $v . '</option>'; } ?> </select> </p> <p> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('position'); ?> " name="<?php echo $this->get_field_name('position'); ?> " <?php checked($instance['position'], true); ?> /> <label for="<?php echo $this->get_field_id('position'); ?> "><?php _e('First widget', 'wpsight'); ?> </label><br /> <span class="description"><?php _e('Position of the widget in the row.', 'wpsight'); ?> </span> </p><?php }
function form($instance) { global $options; $instance = wp_parse_args((array) $instance, array('title' => '', 'cat' => '', 'number' => '3', 'length' => 25)); $title = $instance['title']; $cat = $instance['cat']; if (!isset($instance['number']) || !($number = (int) $instance['number'])) { $number = 3; } if (!isset($instance['length']) || !($length = (int) $instance['length'])) { $length = 25; } $width = isset($instance['width']) ? $instance['width'] : 'full'; ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title', 'wpsight'); ?> : <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('cat'); ?> "><?php _e('Category', 'wpsight'); ?> :</label> <select class="widefat" id="<?php echo $this->get_field_id('cat'); ?> " name="<?php echo $this->get_field_name('cat'); ?> "> <option value=""><?php _e('Most recent posts', 'wpsight'); ?> </option> <?php $categories = get_categories('orderby=name&hide_empty=0'); foreach ($categories as $category) { echo '<option value="' . $category->cat_ID . '" ' . selected($category->cat_ID, $cat, false) . '>' . $category->cat_name . '</option>'; } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('number'); ?> "><?php _e('Number of posts to show', 'wpsight'); ?> :</label> <input id="<?php echo $this->get_field_id('number'); ?> " name="<?php echo $this->get_field_name('number'); ?> " type="text" value="<?php echo $number; ?> " size="3" /><br /><small><?php _e('(at most 20)', 'wpsight'); ?> </small> </p> <p> <label for="<?php echo $this->get_field_id('length'); ?> "><?php _e('Number of words in excerpt', 'wpsight'); ?> :</label> <input id="<?php echo $this->get_field_id('length'); ?> " name="<?php echo $this->get_field_name('length'); ?> " type="text" value="<?php echo $length; ?> " size="3" /> </p> <p> <label for="<?php echo $this->get_field_id('width'); ?> "><?php _e('Width', 'wpsight'); ?> :</label> <select class="widefat" id="<?php echo $this->get_field_id('width'); ?> " name="<?php echo $this->get_field_name('width'); ?> "> <?php foreach (wpsight_widget_widths() as $k => $v) { echo '<option value="' . $k . '"' . selected($k, $width, false) . '>' . $v . '</option>'; } ?> </select> </p><?php }
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'cat' => '', 'number' => '3', 'length' => 25)); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $filter = isset($instance['filter']) ? $instance['filter'] : false; if (!isset($instance['number']) || !($number = (int) $instance['number'])) { $number = 3; } if (!isset($instance['length']) || !($length = (int) $instance['length'])) { $length = 25; } $width = isset($instance['width']) ? $instance['width'] : wpsight_get_span('small'); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title', 'wpsight'); ?> : <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('filter'); ?> "><?php _e('Filter', 'wpsight'); ?> :</label> <?php do_action('wpsight_widget_listings_latest_filter', $this->get_field_id('filter'), $this->get_field_name('filter'), $instance); ?> </p> <p> <label for="<?php echo $this->get_field_id('number'); ?> "><?php _e('Number of posts to show', 'wpsight'); ?> :</label> <input id="<?php echo $this->get_field_id('number'); ?> " name="<?php echo $this->get_field_name('number'); ?> " type="text" value="<?php echo $number; ?> " size="3" /><br /><small><?php _e('(at most 20)', 'wpsight'); ?> </small> </p> <p> <label for="<?php echo $this->get_field_id('length'); ?> "><?php _e('Number of words in excerpt', 'wpsight'); ?> :</label> <input id="<?php echo $this->get_field_id('length'); ?> " name="<?php echo $this->get_field_name('length'); ?> " type="text" value="<?php echo $length; ?> " size="3" /> </p> <p> <label for="<?php echo $this->get_field_id('width'); ?> "><?php _e('Width', 'wpsight'); ?> :</label> <select class="widefat" id="<?php echo $this->get_field_id('width'); ?> " name="<?php echo $this->get_field_name('width'); ?> "> <?php foreach (wpsight_widget_widths() as $k => $v) { echo '<option value="' . $k . '"' . selected($k, $width, false) . '>' . $v . '</option>'; } ?> </select> </p><?php }