user_nicename . '/#person'; } /** * @id for a BreadcrumbList entity. * * @param int $post_id WordPress post ID. * @return string */ public static function breadcrumb( $post_id ) { return get_permalink( $post_id ) . '#breadcrumb'; } /** * @id for a Place entity on a location page. * * @param int $post_id WordPress post ID. * @return string */ public static function place( $post_id ) { return get_permalink( $post_id ) . '#place'; } /** * @id for a FAQPage entity, so another entity on the same page can * reference it via subjectOf. * * @param int $post_id WordPress post ID. * @return string */ public static function faq_page( $post_id ) { return get_permalink( $post_id ) . '#faq'; } /** * @id for a PodcastEpisode entity. * * @param int $post_id WordPress post ID. * @return string */ public static function podcast_episode( $post_id ) { return get_permalink( $post_id ) . '#podcast-episode'; } /** * @id for a SoftwareApplication entity. * * @param int $post_id WordPress post ID. * @return string */ public static function software_app( $post_id ) { return get_permalink( $post_id ) . '#software-application'; } /** * @id for a CreativeWork entity (portfolio item). * * @param int $post_id WordPress post ID. * @return string */ public static function creative_work( $post_id ) { return get_permalink( $post_id ) . '#creative-work'; } /** * @id for the primary site-wide entity. * * Returns the LocalBusiness @id for local business sites, or the Organization * @id for all other site types. Use this anywhere you need to reference the * homepage entity without knowing the site type. * * @return string */ public static function primary_entity() { if ( class_exists( 'Schema_AI_Site_Type' ) && Schema_AI_Site_Type::is_local_business() ) { return self::local_business(); } return self::organization(); } /** * @id for a taxonomy term archive's CollectionPage entity. * * @param string $taxonomy Taxonomy slug (e.g. 'category', 'post_tag'). * @param int $term_id Term ID. * @return string */ public static function archive( $taxonomy, $term_id ) { $link = get_term_link( $term_id, $taxonomy ); $base = is_wp_error( $link ) ? trailingslashit( home_url( '/' ) ) : $link; return $base . '#collectionpage'; } /** * Build a minimal cross-reference stub: {"@id": "..."}. * * Use this when one entity needs to reference another without redefining it. * * @param string $id The @id value. * @return array */ public static function ref( $id ) { return array( '@id' => $id ); } }