post_type = esc_attr( $args['post_type'] ); } $query_args = array(); if ( isset( $args['query_args'] ) ) { $this->query_args = $args['query_args']; } $query_args = $this->query_args; $query_args = array_merge( $query_args, array( 'post_type' => $this->post_type, 'post_status' => 'publish', 'posts_per_page' => -1, 'no_found_rows' => true, ) ); $the_query = new \WP_Query( $query_args ); $options = array(); $options[0] = esc_html__( '— Select —', 'ns-customizer-utilities' ); $all_posts = get_posts( $query_args ); if ( $all_posts ) { foreach ( $all_posts as $key => $p ) { $options[ strval( $p->ID ) ] = get_the_title( $p->ID ); } } $this->choices = $options; parent::__construct( $manager, $id, $args ); } }