get_post_data( $post_id ); if ( empty( $post_data ) ) { return array( '@type' => $this->type ); } $schema = array( '@type' => $this->type, '@id' => Schema_AI_ID_Builder::creative_work( $post_id ), 'name' => $post_data['title'], 'description' => $post_data['excerpt'], 'url' => $post_data['url'], 'dateCreated' => $post_data['date'], 'dateModified' => $post_data['modified'], ); // Featured image. $image = $this->get_image_data( $post_id ); if ( ! empty( $image ) ) { $schema['image'] = $image; } // Creator — the agency/person who created the work. $author_ref = $this->get_author_reference( $post_id ); if ( ! empty( $author_ref ) ) { $schema['creator'] = $author_ref; } else { // Fall back to site-wide publisher entity. $schema['creator'] = $this->get_publisher_reference(); } // Client / recipient (about — who the work was made for). if ( ! empty( $fields['about'] ) ) { $schema['about'] = $fields['about']; } // Genre / medium (e.g. "Web Design", "Brand Identity"). if ( ! empty( $fields['genre'] ) ) { $schema['genre'] = $fields['genre']; } // Keywords from tags/categories. $categories = $this->get_categories( $post_id ); if ( ! empty( $categories ) ) { $schema['keywords'] = implode( ', ', $categories ); } $schema = $this->merge_fields( $schema, $fields, array( 'name', 'description', 'image', 'creator', 'about', 'genre', 'keywords', 'inLanguage', 'license', 'award', 'accountablePerson', 'material', ) ); return $schema; } }