PluginProbe
Slider Ultimate / 2.2.10
Slider Ultimate v2.2.10
2.2.10 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 All 54 releases
ultimate-slider / lib / simple-admin-pages / classes / AdminPageSetting.SelectPost.class.php
AdminPageSetting.SelectPost.class.php
70 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Register, display and save a selection with a drop-down list of any post type
5 *
6 * This setting accepts the following arguments in its constructor function.
7 *
8 * $args = array(
9 * 'id' => 'setting_id', // Unique id
10 * 'title' => 'My Setting', // Title or label for the setting
11 * 'description' => 'Description', // Help text description
12 * 'blank_option' => true, // Whether or not to show a blank option
13 * 'args' => array(); // Arguments to pass to WordPress's get_post() function
14 * );
15 *
16 * @since 1.0
17 * @package Simple Admin Pages
18 */
19
20 class sapAdminPageSettingSelectPost_2_6_19 extends sapAdminPageSetting_2_6_19 {
21
22 public $sanitize_callback = 'intval';
23
24 // Whether or not to display a blank option
25 public $blank_option = true;
26
27 /**
28 * An array of arguments accepted by get_posts().
29 * See: http://codex.wordpress.org/Template_Tags/get_posts
30 */
31 public $args = array();
32
33 /**
34 * Display this setting
35 * @since 1.0
36 */
37 public function display_setting() {
38
39 $posts = new WP_Query( $this->args );
40
41 ?>
42
43 <fieldset <?php $this->print_conditional_data(); ?>>
44
45 <select name="<?php echo esc_attr( $this->get_input_name() ); ?>" id="<?php echo esc_attr( $this->get_input_name() ); ?>" <?php echo ( $this->disabled ? 'disabled' : ''); ?>>
46
47 <?php if ( $this->blank_option === true ) : ?>
48 <option></option>
49 <?php endif; ?>
50
51 <?php while( $posts->have_posts() ) : $posts->next_post(); ?>
52 <option value="<?php echo absint( $posts->post->ID ); ?>" <?php selected( $this->value, $posts->post->ID ); ?>><?php echo esc_attr( $posts->post->post_title ); ?></option>
53 <?php endwhile; ?>
54
55 </select>
56
57 <?php $this->display_disabled(); ?>
58
59 </fieldset>
60
61 <?php
62
63 wp_reset_postdata();
64
65 $this->display_description();
66
67 }
68
69 }
70