parent = $parent; $this->option_name = $field['option_name']; $this->option_id = parent::beautifyid($field['option_name']); $this->value = $value; $this->field = wp_parse_args( $field, array( 'id' => '', 'title' => '', 'desc' => '', 'default' => '', 'holder' => __('Select', 'eof'), 'sizes' => 'regular', 'readonly' => false, 'data' => array('post_type' => 'page') ) ); // If value does not set, use the default if( is_null($this->value) ) { $this->value = $this->field['default']; } parent::__construct($this->field); } /** * Render field * * Create the HTML interface for your field * * @param $field - an array holding all the field's data * * @since 1.0 * @return void */ public function render_field() { $options = array(); // Checks if post type exists /*if( !post_type_exists( $this->field['data']['post_type'] ) ) { echo '

'; return ; } */ $page_args = wp_parse_args( $this->field['data'], array( 'post_type' => 'page', 'posts_per_page' => -1 ) ); $page_query = new WP_Query($page_args); if($page_query->have_posts()) : while($page_query->have_posts()) : $page_query->the_post(); $options[get_the_ID()] = get_the_title(); endwhile; endif; wp_reset_postdata(); $class = ''; switch ($this->field['sizes']) { case "small": $class .= ' seof-small-select'; break; case "large": $class .= ' eof-large-select'; break; default: $class .= ' eof-regular-select'; break; } ?> field['desc']; ?>