';
$home_title = 'Home';
// Get the query & post information
global $post, $wp_query;
// Do not display on the homepage
if ( ! is_front_page() ) {
echo '
';
echo '
';
echo '- ' . esc_html( $home_title ) . '
';// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo ' ';
if ( is_archive() ) {
if ( ! is_tax() && ! is_category() && ! is_tag() ) {
echo '- ' . post_type_archive_title( '', false ) . '
';
} else {
$post_type = get_post_type();
if ( $post_type != 'post' ) {
$post_type_object = get_post_type_object( $post_type );
$post_type_archive = get_post_type_archive_link( $post_type );
echo '- ' . esc_html( $post_type_object->labels->name ) . '
';
echo ' ';
}
echo '- ' . single_term_title( '', false ) . '
';
}
} elseif ( is_single() ) {
$post_type = get_post_type();
if ( $post_type != 'post' ) {
$post_type_object = get_post_type_object( $post_type );
$post_type_archive = get_post_type_archive_link( $post_type );
echo '- ' . esc_html( $post_type_object->labels->name ) ) . '
';
echo ' ';
}
$category = get_the_category();
if ( ! empty( $category ) ) {
$last_category = end( $category );
$cat_parents = rtrim( get_category_parents( $last_category->term_id, true, ',' ), ',' );
$cat_parents = explode( ',', $cat_parents );
foreach ( $cat_parents as $parent ) {
echo '- ' . $parent . '
';// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo ' ';
}
}
echo '- ' . get_the_title() . '
';// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} elseif ( is_page() ) {
if ( $post->post_parent ) {
$ancestors = get_post_ancestors( $post->ID );
$ancestors = array_reverse( $ancestors );
foreach ( $ancestors as $ancestor ) {
echo '- ' . get_the_title( $ancestor ) . '
';// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo ' ';
}
}
echo '- ' . get_the_title() . '
';// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} elseif ( is_category() ) {
echo '- ' . single_cat_title( '', false ) . '
';
} elseif ( is_tag() ) {
echo '- ' . single_tag_title( '', false ) . '
';
} elseif ( is_day() ) {
echo '- ' . get_the_time( 'Y' ) . '
';// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo ' ';
echo '- ' . get_the_time( 'F' ) . '
';/// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo ' ';
echo '- ' . get_the_time( 'jS' ) . '
';// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} elseif ( is_month() ) {
echo '- ' . get_the_time( 'Y' ) . '
';// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo ' ';
echo '- ' . get_the_time( 'F' ) . '
';// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} elseif ( is_year() ) {
echo '- ' . get_the_time( 'Y' ) . '
';// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} elseif ( is_author() ) {
global $author;
$userdata = get_userdata( $author );
echo '- Author: ' . esc_html( $userdata->display_name ) . '
';
} elseif ( is_search() ) {
echo '- Search results for: ' . get_search_query() . '
';
} elseif ( is_404() ) {
echo '- Error 404
';
}
echo '
';
echo '
';
}
}
// Add breadcrumb action
add_action( 'blog_reflection_breadcrumb', 'blog_reflection_breadcrumb' );
// Post pagination function
function blog_reflection_post_pagination() {
the_posts_pagination( array(
'screen_reader_text' => '',
'prev_text' => '',
'next_text' => '',
'type' => 'list',
'mid_size' => 1,
) );
}