function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'disc_no' => '', 'show_tracks' => 'on', 'hide_players' => '', 'no_bottom_margin' => '', 'color' => '', 'background_color' => '', 'background_image' => '', 'background_repeat' => 'repeat', 'parallax' => '', 'parallax_speed' => 4)); $title = $instance['title']; $disc_no = $instance['disc_no']; $showtracks = $instance['show_tracks']; $hide_players = $instance['hide_players']; $no_bottom_margin = $instance['no_bottom_margin']; $color = $instance['color']; $background_color = $instance['background_color']; $background_image = $instance['background_image']; $background_repeat = $instance['background_repeat']; $parallax = $instance['parallax']; $parallax_speed = $instance['parallax_speed']; echo '<p><label for="' . $this->get_field_id('title') . '">' . __('Title (optional):', 'ci_theme') . '</label><input id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . esc_attr($title) . '" class="widefat" /></p>'; ?> <p> <label for="<?php echo $this->get_field_id('disco_no'); ?> "><?php _e('Select Discography Item:', 'ci_theme'); ?> </label> <?php wp_dropdown_posts(array('post_type' => 'cpt_discography', 'selected' => $disc_no, 'class' => 'widefat'), $this->get_field_name('disc_no')); ?> </p> <p><label><input type="checkbox" name="<?php echo $this->get_field_name('show_tracks'); ?> " id="<?php echo $this->get_field_id('show_tracks'); ?> " value="on" <?php checked($showtracks, 'on'); ?> /><?php _e('Show track listing.', 'ci_theme'); ?> </label></p> <p><label><input type="checkbox" name="<?php echo $this->get_field_name('hide_players'); ?> " id="<?php echo $this->get_field_id('hide_players'); ?> " value="on" <?php checked($hide_players, 'on'); ?> /><?php _e('Hide player buttons.', 'ci_theme'); ?> </label></p> <p><?php _e('Please note that the "Show track listing" option above, only works for discography items that have their tracks registered through the <strong>Discography Settings - Track details</strong> pane.', 'ci_theme'); ?> </p> <p><label for="<?php echo $this->get_field_id('no_bottom_margin'); ?> "><input type="checkbox" name="<?php echo $this->get_field_name('no_bottom_margin'); ?> " id="<?php echo $this->get_field_id('no_bottom_margin'); ?> " value="on" <?php checked($no_bottom_margin, 'on'); ?> /><?php _e('Reduce bottom margin.', 'ci_theme'); ?> </label></p> <fieldset class="ci-collapsible"> <legend><?php _e('Custom Colors', 'ci_theme'); ?> <i class="dashicons dashicons-arrow-down"></i></legend> <div class="elements"> <p><label for="<?php echo $this->get_field_id('color'); ?> "><?php _e('Foreground Color:', 'ci_theme'); ?> </label><input id="<?php echo $this->get_field_id('color'); ?> " name="<?php echo $this->get_field_name('color'); ?> " type="text" value="<?php echo esc_attr($color); ?> " class="colorpckr widefat" /></p> <p><label for="<?php echo $this->get_field_id('background_color'); ?> "><?php _e('Background Color:', 'ci_theme'); ?> </label><input id="<?php echo $this->get_field_id('background_color'); ?> " name="<?php echo $this->get_field_name('background_color'); ?> " type="text" value="<?php echo esc_attr($background_color); ?> " class="colorpckr widefat" /></p> <p class="ci-collapsible-media"><label for="<?php echo $this->get_field_id('background_image'); ?> "><?php _e('Background Image:', 'ci_theme'); ?> </label><input id="<?php echo $this->get_field_id('background_image'); ?> " name="<?php echo $this->get_field_name('background_image'); ?> " type="text" value="<?php echo esc_attr($background_image); ?> " class="uploaded widefat" /><a href="#" class="button ci-upload"><?php _e('Upload', 'ci_theme'); ?> </a></p> <p> <label for="<?php echo $this->get_field_id('background_repeat'); ?> "><?php _e('Background Repeat:', 'ci_theme'); ?> </label> <select id="<?php echo $this->get_field_id('background_repeat'); ?> " class="widefat" name="<?php echo $this->get_field_name('background_repeat'); ?> "> <option value="repeat" <?php selected('repeat', $background_repeat); ?> ><?php _e('Repeat', 'ci_theme'); ?> </option> <option value="repeat-x" <?php selected('repeat-x', $background_repeat); ?> ><?php _e('Repeat Horizontally', 'ci_theme'); ?> </option> <option value="repeat-y" <?php selected('repeat-y', $background_repeat); ?> ><?php _e('Repeat Vertically', 'ci_theme'); ?> </option> <option value="no-repeat" <?php selected('no-repeat', $background_repeat); ?> ><?php _e('No Repeat', 'ci_theme'); ?> </option> </select> </p> <p><label for="<?php echo $this->get_field_id('parallax'); ?> "><input type="checkbox" name="<?php echo $this->get_field_name('parallax'); ?> " id="<?php echo $this->get_field_id('parallax'); ?> " value="parallax" <?php checked($parallax, 'parallax'); ?> /><?php _e('Parallax effect (requires a background image).', 'ci_theme'); ?> </label></p> <p><label for="<?php echo $this->get_field_id('parallax_speed'); ?> "><?php _e('Parallax speed (1-8):', 'ci_theme'); ?> </label><input id="<?php echo $this->get_field_id('parallax_speed'); ?> " name="<?php echo $this->get_field_name('parallax_speed'); ?> " type="number" min="1" max="8" step="1" value="<?php echo esc_attr($parallax_speed); ?> " class="widefat" /></p> </div> </fieldset> <?php }
static function _ajax_get_posts() { $post_type_name = sanitize_key($_POST['post_type_name']); $name_field = esc_attr($_POST['name_field']); $str = wp_dropdown_posts(array('echo' => false, 'post_type' => $post_type_name, 'show_option_none' => ' ', 'class' => 'widefat'), $name_field); echo $str; die; }
<fieldset class="set"> <p class="guide"><?php _e('You can enable the front page music player by selecting a Discography item. Its tracklisting will be used as the source of the songs. Any SoundCloud links you might have will be ignored. Alternatively, you can provide a stream URL and name. If a stream URL is set, the Discography item will be ignored.', 'ci_theme'); ?> </p> <label for="<?php echo THEME_OPTIONS . '[music_player_post_id]'; ?> "><?php _e('Select an album:', 'ci_theme'); ?> </label> <?php wp_dropdown_posts(array('post_type' => 'cpt_discography', 'selected' => $ci['music_player_post_id'], 'show_option_none' => ' ', 'option_none_value' => '', 'select_even_if_empty' => true), THEME_OPTIONS . '[music_player_post_id]'); ?> <p> <?php ci_panel_checkbox('music_player_autoplay', 'on', __('Enable autoplay on page load?', 'ci_theme')); ?> </p> </fieldset> <fieldset class="set"> <p class="guide"><?php _e('Both Icecast and Shoutcast streams are supported by the player, however you need to find the appropriate stream URL that points to your actual stream, and not a .pls file. If your stream URL contains an IP or it does not seem to work, add a semicolon at the end, e.g. "http://192.102.192.1:8006/stream;".', 'ci_theme'); ?> </p> <?php