$wp_query->query_vars['day'] ) ), 'type' => 'CollectionPage' ]; // phpcs:enable Squiz.NamingConventions.ValidVariableName return $this->setPositions( $breadcrumbs ); } /** * Sets the position for each breadcrumb after adding the root breadcrumb first. * * If no breadcrumbs are passed, then we assume we're on the homepage and just need the root breadcrumb. * * @since 4.0.0 * * @param array $breadcrumbs The breadcrumb trail. * @return array The modified breadcrumb trail. */ public function setPositions( $breadcrumbs = [] ) { // If the array isn't two-dimensional, then we need to wrap it in another array before continuing. if ( count( $breadcrumbs ) && count( $breadcrumbs ) === count( $breadcrumbs, COUNT_RECURSIVE ) ) { $breadcrumbs = [ $breadcrumbs ]; } // The homepage needs to be root item of all trails. $homepage = [ // Translators: This refers to the homepage of the site. 'name' => apply_filters( 'aioseo_schema_breadcrumbs_home', __( 'Home', 'all-in-one-seo-pack' ) ), 'description' => aioseo()->meta->description->getHomePageDescription(), 'url' => trailingslashit( home_url() ), 'type' => 'posts' === get_option( 'show_on_front' ) ? 'CollectionPage' : 'WebPage' ]; array_unshift( $breadcrumbs, $homepage ); $breadcrumbs = array_filter( $breadcrumbs ); foreach ( $breadcrumbs as $index => &$breadcrumb ) { $breadcrumb['position'] = $index + 1; } return $breadcrumbs; } /** * Returns the most relevant WebPage graph for the post. * * @since 4.2.5 * * @return string The graph name. */ private function getPostWebPageGraph() { foreach ( aioseo()->schema->graphs as $graphName ) { if ( in_array( $graphName, aioseo()->schema->webPageGraphs, true ) ) { return $graphName; } } // Return the default if no WebPage graph was found. return 'WebPage'; } }