public function handle_template( $template, $post_id ) {
		if ( in_array( $template, array_keys( wp_get_theme()->get_page_templates( $this->get_post( $post_id ) ) ), true ) ) {
			update_post_meta( $post_id, '_wp_page_template', $template );
		} else {
			update_post_meta( $post_id, '_wp_page_template', '' );
		}
	}
public function handle_template( $template, $post_id ) {
		if ( in_array( $template, array_keys( wp_get_theme()->get_page_templates( $this->get_post( $post_id ) ) ), true ) ) {
			update_post_meta( $post_id, '_wp_page_template', $template );
		} else {
			update_post_meta( $post_id, '_wp_page_template', '' );
		}
	}
public function handle_template ( $ template , $ post_id ) { if ( in_array ( $ template , array_keys ( wp_get_theme ( ) -> get_page_templates ( $ this -> get_post ( $ post_id ) ) ) , true ) ) { update_post_meta ( $ post_id , '_wp_page_template' , $ template ) ; } else { update_post_meta ( $ post_id , '_wp_page_template' , '' ) ; } }
Set the template for a page.

@param string  $template Page template filename.
@param integer $post_id  Post ID.
Set the template for a page .