setup_client( $client ); } /** * Given the client data, let's set the variables * * @since 2.3.6 * * @param object $client The Client Object. * * @return bool If the setup was successful or not */ private function setup_client( $client ) { if ( ! is_object( $client ) ) { return false; } if ( ! is_a( $client, 'WP_Post' ) ) { return false; } if ( 'client' !== $client->post_type ) { return false; } // sets the value of each key. foreach ( $client as $key => $value ) { switch ( $key ) { default: $this->$key = $value; break; } } return true; } /** * Get a meta value * * @since 1.0.0 * * @param string $meta the meta field (without prefix). * * @return mixed */ public function get_meta( $meta ) { $result = get_post_meta( $this->ID, $this->meta_prefix . $meta, true ); if ( ! $result ) { $result = null; } return $result; } }