function delaware_breadcrumbs( $args = '' ) {
$args = wp_parse_args( $args, array(
'separator' => '',
'home' => esc_html__( 'Home', 'delaware' ),
) );
$items = array();
$position = 1;
// HOME
$items[] = array(
'url' => get_home_url(),
'name' => $args['home'],
'pos' => $position++
);
// SINGLE POST
if ( is_singular() ) {
global $post;
// Post type archive (if not post)
if ( get_post_type() !== 'post' ) {
$post_type = get_post_type_object( get_post_type() );
if ( $post_type && $post_type->has_archive ) {
$items[] = array(
'url' => get_post_type_archive_link( get_post_type() ),
'name' => $post_type->labels->name,
'pos' => $position++
);
}
}
// Current page/post (no link)
$items[] = array(
'url' => '',
'name' => get_the_title(),
'pos' => $position++
);
}
// PAGE
elseif ( is_page() ) {
global $post;
if ( $post->post_parent ) {
$parents = array_reverse( get_post_ancestors( $post->ID ) );
foreach ( $parents as $parent ) {
$items[] = array(
'url' => get_permalink( $parent ),
'name' => get_the_title( $parent ),
'pos' => $position++
);
}
}
$items[] = array(
'url' => '',
'name' => get_the_title(),
'pos' => $position++
);
}
// CATEGORY / TAXONOMY
elseif ( is_category() || is_tax() ) {
$term = get_queried_object();
$items[] = array(
'url' => '',
'name' => $term->name,
'pos' => $position++
);
}
// RENDER SCHEMA.ORG OUTPUT
echo '';
}
Comments for AVA
https://alfred-victoria.com/
Management Consultants
Thu, 23 Apr 2026 16:43:17 +0000
hourly
1
https://wordpress.org/?v=6.9.4