function form($instance) { // Output admin widget options form // Set up some default widget settings. $defaults = $this->get_defaults(); $instance = wp_parse_args((array) $instance, $defaults); $icons = $this->social_icons(); $instance = wp_parse_args((array) $instance, $icons); sgwindow_echo_input_text($this, 'title', $instance, __('Title: ', 'sg-window'), 0); sgwindow_echo_input_checkbox($this, 'is_small', $instance, __('Small Icons.', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_vertical', $instance, __('Vertical Icons.', 'sg-window')); foreach ($icons as $id => $icon) { sgwindow_echo_input_text($this, $id, $instance, $id); } }
/** * Widget form * * @since SG Window 1.0.0 * * @param array $instance Array of widget options. */ function form($instance) { // Set up some default widget settings. $instance = wp_parse_args((array) $instance, $this->defaults()); sgwindow_echo_input_text($this, 'title', $instance, __('Title: ', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_one_page', $instance, __('One page navigation (portfolio index)', 'sg-window')); }
/** * Widget form * * @since SG Window 1.1.0 * * @param array $instance Array of widget options. */ function form($instance) { // Output admin widget options form // Set up some default widget settings. $instance = wp_parse_args((array) $instance, $this->defaults($instance)); sgwindow_echo_input_text($this, 'title', $instance, __('Title: ', 'sg-window'), 0); sgwindow_echo_input_text($this, 'count', $instance, __('Number of Slides', 'sg-window')); /* What to display */ _e('What you wish to display? (<span style="color:red;">Press "Apply" button to see new fields</span>):', 'sg-window'); ?> <select id="<?php echo $this->get_field_id('content_type'); ?> " name="<?php echo $this->get_field_name('content_type'); ?> " style="width:100%;"> <option value="0" <?php selected($instance['content_type'], '0'); ?> ><?php esc_html_e('Custom Slides', 'sg-window'); ?> </option> <option value="1" <?php selected($instance['content_type'], '1'); ?> ><?php esc_html_e('Posts from the Category', 'sg-window'); ?> </option> <?php if (class_exists('Jetpack')) { ?> <option value="2" <?php selected($instance['content_type'], '2'); ?> ><?php esc_html_e('Portfolio Projects', 'sg-window'); ?> </option> <?php } ?> <option value="3" <?php selected($instance['content_type'], '3'); ?> ><?php esc_html_e('Posts from the Current Query ( from Blog )', 'sg-window'); ?> </option> <option value="4" <?php selected($instance['content_type'], '4'); ?> ><?php esc_html_e('Sticky Posts', 'sg-window'); ?> </option> <option value="5" <?php selected($instance['content_type'], '5'); ?> ><?php esc_html_e('Related Posts', 'sg-window'); ?> </option> <option value="6" <?php selected($instance['content_type'], '6'); ?> ><?php esc_html_e('Popular Posts (Jetpack)', 'sg-window'); ?> </option> </select> <?php if ('1' == $instance['content_type'] || '2' == $instance['content_type'] || '4' == $instance['content_type'] || '5' == $instance['content_type']) { esc_html_e('Sort Order:', 'sg-window'); ?> <select id="<?php echo $this->get_field_id('order'); ?> " name="<?php echo $this->get_field_name('order'); ?> " style="width:100%;"> <option value="date" <?php selected($instance['order'], 'date'); ?> ><?php esc_html_e('Date', 'sg-window'); ?> </option> <option value="rand" <?php selected($instance['order'], 'rand'); ?> ><?php esc_html_e('Random', 'sg-window'); ?> </option> <option value="comment_count" <?php selected($instance['order'], 'comment_count'); ?> ><?php esc_html_e('Number of Comments', 'sg-window'); ?> </option> </select> <?php } /* Category */ if ('1' == $instance['content_type'] || '3' == $instance['content_type'] || '4' == $instance['content_type'] || '5' == $instance['content_type'] || '6' == $instance['content_type']) { sgwindow_echo_input_checkbox($this, 'is_cat', $instance, __('Display Category', 'sg-window')); } /* Is Pages */ if ('6' == $instance['content_type']) { sgwindow_echo_input_checkbox($this, 'is_popular_pages', $instance, __('Display Popular Pages', 'sg-window')); } if ('1' == $instance['content_type'] || '4' == $instance['content_type']) { $tax = 'category'; $terms = get_terms($tax); if ($terms && !is_wp_error($terms)) { esc_html_e('Category:', 'sg-window'); ?> <select id="<?php echo $this->get_field_id('category'); ?> " name="<?php echo $this->get_field_name('category'); ?> " style="width:100%;"> <option value="0"><?php esc_html_e('Any', 'sg-window'); ?> </option> <?php foreach ($terms as $term) { echo '<option value="' . esc_attr($term->term_id) . '" '; selected($instance['category'], $term->term_id); echo '>' . esc_html($term->name) . '</option>'; } ?> </select> <?php } } /* Project */ if ('2' == $instance['content_type']) { $tax = 'jetpack-portfolio-type'; $terms = get_terms($tax); if ($terms && !is_wp_error($terms)) { esc_html_e('Project:', 'sg-window'); ?> <select id="<?php echo $this->get_field_id($tax); ?> " name="<?php echo $this->get_field_name($tax); ?> " style="width:100%;"> <option value="0"><?php esc_html_e('Any', 'sg-window'); ?> </option> <?php foreach ($terms as $term) { echo '<option value="' . esc_attr($term->term_id) . '" '; selected($instance[$tax], $term->term_id); echo '>' . esc_html($term->name) . '</option>'; } ?> </select> <?php } } if ('0' == $instance['content_type']) { for ($i = 0; $i < $instance['count']; $i++) { if (!isset($instance['link_' . $i]) || empty($instance['link_' . $i])) { $instance['link_' . $i] = '#'; } if (!isset($instance['img_' . $i]) || empty($instance['img_' . $i]) || '' == $instance['img_' . $i]) { $instance['img_' . $i] = $instance['img_0']; } if (!isset($instance['title_' . $i]) || empty($instance['title_' . $i])) { $instance['title_' . $i] = __('Slide Title', 'sg-window') . ' ' . ($i + 1); } if (!isset($instance['descr_' . $i]) || empty($instance['descr_' . $i])) { $instance['descr_' . $i] = __('description', 'sg-window'); } if (!isset($instance['is_link_' . $i]) || empty($instance['is_link_' . $i])) { $instance['is_link_' . $i] = $instance['is_link']; } sgwindow_echo_section_main_start(__('Edit Image ', 'sg-window') . ($i + 1), $this->get_field_id('title_' . $i) . $i); sgwindow_echo_input_upload_id($this, 'img_' . $i, $instance, __('Image: ', 'sg-window')); sgwindow_echo_input_text($this, 'title_' . $i, $instance, __('Title: ', 'sg-window')); sgwindow_echo_input_text($this, 'descr_' . $i, $instance, __('Description: ', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_link_' . $i, $instance, __('Display Link? ', 'sg-window')); sgwindow_echo_input_text($this, 'link_' . $i, $instance, __('Link: ', 'sg-window')); sgwindow_echo_section_main_end(); } } sgwindow_echo_section_start(__('Slider options', 'sg-window'), $this->get_field_id('speed')); sgwindow_echo_input_text($this, 'speed', $instance, __('Movement Speed (ms): ', 'sg-window')); sgwindow_echo_input_text($this, 'delay', $instance, __('Delay (ms): ', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_play', $instance, __('Auto play slides', 'sg-window')); sgwindow_echo_input_text($this, 'height', $instance, __('Height of slides (number between 10-100, % of width): ', 'sg-window')); sgwindow_echo_input_text($this, 'margin', $instance, __('Visible part of the next and previous slide ( number between 0-34, %): ', 'sg-window')); sgwindow_echo_input_color($this, 'text_color', $instance, __('Text color: ', 'sg-window'), '#ffffff'); sgwindow_echo_input_checkbox($this, 'is_background', $instance, __('Display Image as background ', 'sg-window')); sgwindow_echo_section_end(); }
/** * Widget form * * @since SG Window 1.1.0 * * @param array $instance Array of widget options. */ function form($instance) { // Output admin widget options form // Set up some default widget settings. $instance = wp_parse_args((array) $instance, $this->defaults($instance)); sgwindow_echo_input_text($this, 'title', $instance, __('Title: ', 'sg-window'), 0); $widget_id = str_replace('-' . 'count', '', $this->get_field_id('count')); $widget_id = substr($widget_id, 7); $id = sgwindow_get_last_id(); $defaults = $this->defaults($instance); ?> <p> <label for="<?php echo esc_attr($this->get_field_id('count')); ?> "><?php echo esc_html(__('Number of sidebars (number in range [1:4]) (Press Apply): ', 'sg-window')); ?> </label> <br> <input type="text" name="<?php echo esc_attr($this->get_field_name('count')); ?> " id="<?php echo esc_attr($this->get_field_id('count')); ?> " class="change-count <?php echo esc_attr($instance['count'] . ' ' . $widget_id); ?> " value="<?php echo esc_attr($instance['count']); ?> " /> </p> <hr> <span id="<?php echo $this->get_field_id('sidebar_id_0'); ?> _b" class="add-sidebar-button <?php echo esc_attr($instance['count']) . ' ' . $widget_id; ?> <?php echo !isset($instance['sidebar_id_0']) ? 'active-class' : ''; ?> "> <?php _e('Register New Sidebars', 'sg-window'); ?> </span> <!-- .add-sidebar-button --> <div id="<?php echo $this->get_field_id('sidebar_id_0'); ?> _wrap" class="sidebar-options <?php echo isset($instance['sidebar_id_0']) ? 'active-class' : ''; ?> "> <?php for ($i = 0; $i < 4; $i++) { if (!isset($instance['sidebar_name_' . $i]) || empty($instance['sidebar_name_' . $i])) { $instance['sidebar_name_' . $i] = __('Sidebar', 'sg-window') . ' ' . $id; } if (!isset($instance['width_' . $i]) || empty($instance['width_' . $i]) || 0 == $instance['width_' . $i]) { $instance['width_' . $i] = 100 / $instance['count']; } if (!isset($instance['sidebar_id_' . $i])) { $instance['sidebar_id_' . $i] = $id++; } ?> <p style="display: none;"> <input type="text" name="<?php echo esc_attr($this->get_field_name('sidebar_id_' . $i)); ?> " id="<?php echo esc_attr($this->get_field_id('sidebar_id_' . $i)); ?> " value="<?php echo esc_attr($instance['sidebar_id_' . $i]); ?> " /> </p> <div id="<?php echo esc_attr($this->get_field_id('sidebar_id_' . $i)); ?> _hide" class="sidebar-button" <?php echo $i >= $instance['count'] ? 'style="display:none"' : ''; ?> > <?php sgwindow_echo_section_main_start(__('Edit Sidebar ', 'sg-window') . ($i + 1), $this->get_field_id('width_' . $i) . $i); sgwindow_echo_input_text($this, 'sidebar_name_' . $i, $instance, __('Name of sidebar (You will see this name after refreshing Customizer): ', 'sg-window')); sgwindow_echo_input_text($this, 'width_' . $i, $instance, __('Width of sidebar (%): ', 'sg-window')); sgwindow_echo_section_main_end(); ?> </div> <?php } ?> </div><!-- .sidebar-options --> <?php }
/** * Widget form * * @since SG Window 1.0.0 * * @param array $instance Array of widget options. */ function form($instance) { // Output admin widget options form // Set up some default widget settings. $instance = wp_parse_args((array) $instance, $this->defaults($instance)); sgwindow_echo_input_text($this, 'title', $instance, __('Title: ', 'sg-window'), 0); $tax = 'product_cat'; $terms = get_terms($tax); if ($terms && !is_wp_error($terms)) { esc_html_e('Category:', 'sg-window'); ?> <select id="<?php echo esc_attr($this->get_field_id('product_cat')); ?> " name="<?php echo esc_attr($this->get_field_name('product_cat')); ?> " style="width:100%;"> <option value="0"><?php esc_html_e('Any', 'sg-window'); ?> </option> <?php foreach ($terms as $term) { echo '<option value="' . esc_attr($term->term_id) . '" '; selected($instance['product_cat'], $term->term_id); echo '>' . esc_html($term->name) . '</option>'; } ?> </select> <?php } ?> <?php esc_html_e('Columns:', 'sg-window'); ?> <select id="<?php echo esc_attr($this->get_field_id('columns')); ?> " name="<?php echo esc_attr($this->get_field_name('columns')); ?> " style="width:100%;"> <?php $styles = array(__('1', 'sg-window'), __('2', 'sg-window'), __('3', 'sg-window'), __('4', 'sg-window')); $styles_ids = array('column-1', 'column-2', 'column-3', 'column-4'); for ($i = 0; $i < 4; $i++) { echo '<option value="' . esc_attr($styles_ids[$i]) . '" '; selected($instance['columns'], $styles_ids[$i]); echo '>' . esc_html($styles[$i]) . '</option>'; } ?> </select> <?php esc_html_e('Image Size:', 'sg-window'); ?> <select id="<?php echo esc_attr($this->get_field_id('image_size')); ?> " name="<?php echo esc_attr($this->get_field_name('image_size')); ?> " style="width:100%;"> <?php $styles = array(__('Post Thumbnail', 'sg-window'), __('Thumbnail', 'sg-window'), __('Large', 'sg-window'), __('Full', 'sg-window')); $styles_ids = array('post-thumbnail', 'thumbnail', 'large', 'full'); foreach ($styles as $i => $type) { echo '<option value="' . esc_attr($styles_ids[$i]) . '" '; selected($instance['image_size'], $styles_ids[$i]); echo '>' . esc_html($styles[$i]) . '</option>'; } ?> </select> <?php sgwindow_echo_input_hover_style($this, 'effect_id', $instance); sgwindow_echo_input_text($this, 'count', $instance, __('Count: ', 'sg-window'), 0); ?> <hr> <?php sgwindow_echo_section_start(__('More options', 'sg-window'), $this->get_field_id('is_link')); sgwindow_echo_input_checkbox($this, 'is_margin_0', $instance, __('No Margins', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_has_description', $instance, __('Display description block', 'sg-window')); if ($instance['is_has_description'] != 0) { sgwindow_echo_input_checkbox($this, 'is_right', $instance, __('Right', 'sg-window')); } sgwindow_echo_section_end(); }
/** * Widget form * * @since SG Window 1.0.0 * * @param array $instance Array of widget options. */ function form($instance) { // Set up some default widget settings. $instance = wp_parse_args((array) $instance, $this->defaults()); $instance = wp_parse_args((array) $instance, $this->defaults_for_count($instance, $instance['count'])); sgwindow_echo_input_text($this, 'title', $instance, __('Title: ', 'sg-window')); for ($i = 0; $i < $instance['count']; $i++) { ?> <hr> <hr> <p style="font-size: 30px; color: red; "> <?php esc_html_e('Button ', 'sg-window'); echo $i + 1; ?> </p> <hr> <hr> <?php sgwindow_echo_input_text($this, 'link_' . $i, $instance, __('URL: ', 'sg-window')); sgwindow_echo_input_text($this, 'caption_' . $i, $instance, __('Caption', 'sg-window')); } sgwindow_echo_input_text($this, 'count', $instance, __('Count: ', 'sg-window')); }
/** * Widget form * * @since SG Window 1.0.0 * * @param array $instance Array of widget options. */ function form($instance) { // Set up some default widget settings. $instance = wp_parse_args((array) $instance, $this->defaults()); sgwindow_echo_input_text($this, 'title', $instance, __('Title: ', 'sg-window')); }
function form($instance) { // Output admin widget options form // Set up some default widget settings. $instance = wp_parse_args((array) $instance, $this->defaults($instance)); $instance = wp_parse_args((array) $instance, $this->defaults_for_count($instance, $instance['count'])); sgwindow_echo_input_text($this, 'title', $instance, __('Title: ', 'sg-window'), 0); sgwindow_echo_section_start(__('Main options', 'sg-window'), $this->get_field_id('is_background')); esc_html_e('Image Size:', 'sg-window'); ?> <select id="<?php echo esc_attr($this->get_field_id('image_size')); ?> " name="<?php echo esc_attr($this->get_field_name('image_size')); ?> " style="width:100%;"> <?php $styles = array(__('Post Thumbnail', 'sg-window'), __('Thumbnail', 'sg-window'), __('Large', 'sg-window'), __('Full', 'sg-window')); $styles_ids = array('post-thumbnail', 'thumbnail', 'large', 'full'); foreach ($styles as $i => $type) { echo '<option value="' . esc_attr($styles_ids[$i]) . '" '; selected($instance['image_size'], $styles_ids[$i]); echo '>' . esc_html($styles[$i]) . '</option>'; } ?> </select> <?php sgwindow_echo_input_checkbox($this, 'is_background', $instance, __('Background Image', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_step', $instance, __('Step Animation', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_margin_0', $instance, __('No Margins', 'sg-window')); sgwindow_echo_section_end(); if ($instance['is_has_description'] != 0) { sgwindow_echo_input_checkbox($this, 'is_right', $instance, __('Right', 'sg-window')); sgwindow_echo_input_text($this, 'main_title', $instance, __('Main Title: ', 'sg-window')); sgwindow_echo_input_textarea($this, 'main_description', $instance, __('Main Description: ', 'sg-window')); } ?> <hr> <?php for ($i = 0; $i < $instance['count']; $i++) { sgwindow_echo_section_main_start(__('Press to edit Image ', 'sg-window') . ($i + 1), $this->get_field_id('image_' . $i) . $i); ?> <hr> <hr> <p style="font-size: 20px; color: red; "> <?php esc_html_e('Image ', 'sg-window'); echo $i + 1; ?> </p> <hr> <hr> <?php sgwindow_echo_input_upload_id($this, 'image_' . $i, $instance, __('Image: ', 'sg-window')); sgwindow_echo_input_hover_style($this, 'effect_id_' . $i, $instance); sgwindow_echo_input_text($this, 'title_' . $i, $instance, __('Header: ', 'sg-window')); sgwindow_echo_section_start(__('More options', 'sg-window'), $this->get_field_id('text_' . $i) . $i); sgwindow_echo_input_textarea($this, 'text_' . $i, $instance, __('Text: ', 'sg-window')); sgwindow_echo_input_text($this, 'link_' . $i, $instance, __('Link: ', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_animate_' . $i, $instance, __('Animate', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_animate_once_' . $i, $instance, __('Once', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_zoom_' . $i, $instance, __('Transparent', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_link_' . $i, $instance, __('Display Link', 'sg-window')); sgwindow_echo_input_text($this, 'link_caption_' . $i, $instance, __('Button caption: ', 'sg-window'), 0); sgwindow_echo_section_end(); sgwindow_echo_section_main_end(); } ?> <hr> <?php esc_html_e('Columns:', 'sg-window'); ?> <select id="<?php echo esc_attr($this->get_field_id('columns')); ?> " name="<?php echo esc_attr($this->get_field_name('columns')); ?> " style="width:100%;"> <?php $styles = array(__('1', 'sg-window'), __('2', 'sg-window'), __('3', 'sg-window'), __('4', 'sg-window')); $styles_ids = array('column-1', 'column-2', 'column-3', 'column-4'); for ($i = 0; $i < 4; $i++) { echo '<option value="' . esc_attr($styles_ids[$i]) . '" '; selected($instance['columns'], $styles_ids[$i]); echo '>' . esc_html($styles[$i]) . '</option>'; } ?> </select> <?php sgwindow_echo_input_text($this, 'count', $instance, __('Number of images (press Apply): ', 'sg-window'), 0); }
/** * Widget form * * @since SG Window 1.0.0 * * @param array $instance Array of widget options. */ function form($instance) { // Output admin widget options form // Set up some default widget settings. $instance = wp_parse_args((array) $instance, $this->defaults($instance)); sgwindow_echo_input_text($this, 'title', $instance, __('Title: ', 'sg-window'), 0); sgwindow_echo_input_checkbox($this, 'is_no_title', $instance, __('No Title', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_centered', $instance, __('Text align center', 'sg-window')); sgwindow_echo_input_checkbox($this, 'is_transparent', $instance, __('Set Background Opacity to 0', 'sg-window')); $pages = get_pages(); esc_html_e('Page:', 'sg-window'); ?> <select id="<?php echo esc_attr($this->get_field_id('page_id')); ?> " name="<?php echo esc_attr($this->get_field_name('page_id')); ?> " style="width:100%;"> <?php foreach ($pages as $page) { echo '<option value="' . esc_attr($page->ID) . '" '; selected($instance['page_id'], $page->ID); echo '>' . esc_html($page->post_title) . '</option>'; } ?> </select> <?php esc_html_e('Layout:', 'sg-window'); ?> <select id="<?php echo esc_attr($this->get_field_id('layout')); ?> " name="<?php echo esc_attr($this->get_field_name('layout')); ?> " style="width:100%;"> <?php $styles = array('right-sidebar' => __('Right Sidebar', 'sg-window'), 'left-sidebar' => __('Left Sidebar', 'sg-window'), 'two-sidebars' => __('Two Sidebars', 'sg-window'), 'no-sidebar' => __('No Sidebars', 'sg-window')); foreach ($styles as $id => $style) { echo '<option value="' . esc_attr($id) . '" '; selected($instance['layout'], $id); echo '>' . esc_html($style) . '</option>'; } ?> </select> <?php }