get_post_data( $post_id ); if ( empty( $post_data ) ) { return array( '@type' => $this->type ); } $schema = array( '@type' => $this->type, '@id' => Schema_AI_ID_Builder::software_app( $post_id ), 'name' => $post_data['title'], 'description' => $post_data['excerpt'], 'url' => $post_data['url'], ); // Featured image → screenshot or logo. $image = $this->get_image_data( $post_id ); if ( ! empty( $image ) ) { $schema['screenshot'] = $image; } // Publisher cross-reference. $schema['author'] = $this->get_publisher_reference(); // Application category (e.g. "BusinessApplication", "GameApplication"). if ( ! empty( $fields['applicationCategory'] ) ) { $schema['applicationCategory'] = $fields['applicationCategory']; } // Operating system (e.g. "Windows 10", "macOS", "Web"). if ( ! empty( $fields['operatingSystem'] ) ) { $schema['operatingSystem'] = $fields['operatingSystem']; } // Software version. if ( ! empty( $fields['softwareVersion'] ) ) { $schema['softwareVersion'] = $fields['softwareVersion']; } // Download URL. if ( ! empty( $fields['downloadUrl'] ) ) { $schema['downloadUrl'] = $fields['downloadUrl']; } // Offers (pricing). if ( ! empty( $fields['offers'] ) ) { $offers = $fields['offers']; if ( is_array( $offers ) && ! isset( $offers['@type'] ) ) { $offers['@type'] = 'Offer'; } $schema['offers'] = $offers; } // Aggregate rating — supported on SoftwareApplication pages. if ( ! empty( $fields['aggregateRating'] ) ) { $rating = $fields['aggregateRating']; if ( is_array( $rating ) && ! isset( $rating['@type'] ) ) { $rating['@type'] = 'AggregateRating'; } $schema['aggregateRating'] = $rating; } $schema = $this->merge_fields( $schema, $fields, array( 'name', 'description', 'screenshot', 'applicationCategory', 'operatingSystem', 'softwareVersion', 'downloadUrl', 'offers', 'aggregateRating', 'featureList', 'releaseNotes', 'requirements', 'softwareHelp', ) ); return $schema; } }