function form($instance) { $defaults = array('title' => '', 'slideshow' => ''); $instance = wp_parse_args((array) $instance, $defaults); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title: ', 'startbox'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo $instance['title']; ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('slideshow'); ?> "><?php _e('Slideshow: ', 'startbox'); ?> </label> <?php $args = array('post_type' => 'slideshow', 'order_by' => 'post_title', 'order' => 'ASC', 'id' => $this->get_field_id('slideshow'), 'name' => $this->get_field_name('slideshow'), 'selected' => $instance['slideshow'], 'option_none_value' => 'Select a Slideshow'); sb_dropdown_posts($args); ?> </p> <p> <a href="<?php echo admin_url('edit.php?post_type=slideshow'); ?> "><?php _e('Edit Slideshow Settings', 'startbox'); ?> </a> </p> <?php }
public function enable_select($args = '') { $defaults = array('id' => 'option-select', 'label' => 'Select', 'value' => '', 'desc' => '', 'options' => '', 'size' => 'large', 'align' => 'right', 'order_by' => 'post_date', 'order' => DESC, 'limit' => 30); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); if (sb_get_option($id . '-enabled') == 'true') { $checked = 'checked="checked"'; } else { $checked = ''; } $output = "\t" . '<p class="' . $id . '">' . "\n"; $output .= "\t" . "\t" . '<label for="' . THEME_OPTIONS . '[' . $id . '-enabled]' . '"><input type="checkbox" class="checkbox" id="' . THEME_OPTIONS . '[' . $id . '-enabled]' . '" name="' . THEME_OPTIONS . '[' . $id . '-enabled]' . '" value="true" ' . $checked . ' /> Enable</label>' . "\n"; $output .= '<span class="right">'; if ($label) { $output .= "\t" . "\t" . '<label for="' . THEME_OPTIONS . '[' . $id . ']' . '">' . $label . ':</label> ' . "\n"; } if ($options == 'categories') { $output .= wp_dropdown_categories(array('echo' => 0, 'name' => THEME_OPTIONS . '[' . $id . ']', 'id' => THEME_OPTIONS . '[' . $id . ']', 'show_option_none' => 'Select a Category', 'selected' => $value)); } elseif ($options == 'pages') { $output .= wp_dropdown_pages(array('echo' => 0, 'name' => THEME_OPTIONS . '[' . $id . ']', 'show_option_none' => 'Select a Page', 'selected' => $value)); } elseif ($options == 'posts') { $output .= sb_dropdown_posts(array('echo' => 0, 'name' => THEME_OPTIONS . '[' . $id . ']', 'id' => THEME_OPTIONS . '[' . $id . ']', 'class' => 'option-select-' . $size . ' ' . $align, 'show_option_none' => 'Select a Post', 'selected' => $value, 'order_by' => $order_by, 'order' => $order, 'limit' => $limit)); } else { $output .= "\t" . "\t" . '<select id="' . THEME_OPTIONS . '[' . $id . ']' . '" name="' . THEME_OPTIONS . '[' . $id . ']' . '" class="option-select-' . $size . ' ' . $align . '">' . "\n"; foreach ($options as $option_id => $option) { if ($value == $option_id) { $select = 'selected="selected"'; } else { $select = ''; } $output .= "\t" . "\t" . "\t" . '<option value="' . $option_id . '" ' . $select . '>' . $option . '</option>' . "\n"; } $output .= "\t" . "\t" . '</select>' . "\n"; } $output .= '</span>'; if ($desc) { $output .= "\t" . "\t" . '<br/><span class="desc"> ' . $desc . ' </span>' . "\n"; } $output .= "\t" . '</p>' . "\n"; return $output; }