Der obs_structured_data_after_breadcrumbs
Filter filtert die Ausgabe der Schema.org Daten für die Breadcrumbs, die auf Produkt -und Kategorieseiten erstellt werden.
Die Schema.org Daten werden als JSON-LD im Header ausgeliefert, siehe Breadcrumb Blöcke für Produkt Templates und Kategorie Templates.
Dieser Filter läuft, nachdem die HTML-Representation erstellt wurde und bevor sie ausgegeben wird.
Beispiel-Anwendung über functions.php in Child-Theme
add_filter( 'obs_structured_data_after_breadcrumbs', 'custom_structured_data_after_breadcrumbs', 10, 3 );
function custom_structured_data_after_breadcrumbs( $structured_data_breadcrumbs, $list_elements, $class) {
// TODO: change the $structured_data_breadcrumbs.
return $structured_data_breadcrumbs;
}
Anleitung zur Integration von Hooks
Eine Integration im Code
/**
* Filter the structured data for breadcrumbs on both Category Pages and Product Pages after creation.
*
* @param array $structured_data_breadcrumbs The structured data as to be returned.
* @param array $list_elements The list elements to be shown as breadcrumbs, if default build-up was used.
* @param string $class The class of the Caller. Either Oneboxshop_Category_Page or Oneboxshop_Product_Page.
*/
$structured_data_breadcrumbs = apply_filters_ref_array(
'obs_structured_data_after_breadcrumbs',
array(
$structured_data_breadcrumbs,
$list_elements,
$class,
),
);