implode( ' ', $classes ),
'aria-label' => __( 'Breadcrumb', 'airo-wp' ),
)
);
// Output directly (WordPress captures echo'd output from render callbacks).
?>
context['postId'] ) ? (int) $block->context['postId'] : 0;
if ( did_action( 'airowp_breadcrumbs_schema_printed' ) ) {
return;
}
// Singular: the trail must be for the queried post. Archives and the
// posts index: the trail describes the requested page itself.
$describes_page = is_singular()
? get_queried_object_id() === $post_id
: airowp_breadcrumb_is_page_level_view( $block ) && ( is_archive() || ( is_home() && ! is_front_page() ) );
if ( ! $describes_page ) {
return;
}
/**
* Whether the Breadcrumbs block prints BreadcrumbList JSON-LD.
*
* SEO plugins such as Yoast SEO and Rank Math print their own; return
* false to leave it to them.
*
* @since 2.8.3
*
* @param bool $enabled Default true.
* @param array $trail Breadcrumb items (title, url).
*/
if ( ! apply_filters( 'airowp_breadcrumbs_schema_enabled', true, $trail ) ) {
return;
}
$schema = airowp_get_breadcrumb_schema( $trail );
$json = $schema ? wp_json_encode( $schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) : false;
if ( false === $json ) {
return;
}
/**
* Fires once the breadcrumb JSON-LD has been printed for this request.
*/
do_action( 'airowp_breadcrumbs_schema_printed' );
// Same guard as SchemaOutput::render(): a `` inside a title
// would otherwise close the element early.
echo ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- wp_json_encode() output with script-closing sequences neutralised.
}
}
airowp_render_breadcrumbs( $attributes, $content, $block );