Помогите решить вопрос с хлебными крошками
-
Подскажите, как убрать из хлебных крошек последнею ссылку.

<?php get_header(); ?> <!-- .header --> <div class="middle"> <main class="content"> <div class="breadcrumbs"> <a href="<?php bloginfo('url'); ?>" class="home"><?php bloginfo('name'); ?></a> <span class="divider">/</span> <?php $cats = get_the_category(get_the_ID()); if ($cats) { foreach($cats as $cat) { $parents = array(); $have_parents = false; $parent_id = $cat->category_parent; while (0 != $parent_id) { $parents***91;***93;=$parent_id; $next_ancestor = get_category( $parent_id ); $parent_id = $next_ancestor->category_parent; } if ($parents) { foreach ($parents as $parent) { $category = get_term_by('ID',$parent, 'category'); ?> <span><a href="<?php echo esc_attr(get_term_link($category, 'category')); ?>"><?php echo $category->name; ?></a></span> <span class="arrow"></span> <?php } //foreach ($parents } } //foreach ($cats } ?> <?php foreach($cats as $cat) { $category = get_term_by('ID',$cat->term_taxonomy_id, 'category'); ?> <span><a href="<?php echo esc_attr(get_term_link($category, 'category')); ?>"><?php echo $category->name; ?></a></span> <?php } ?> </div> <!-- .breadcrumbs --> <article class="post"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <h1 class="post__headline"><?php the_title(); ?></h1> <div class="post__entry"> <?php the_content(); ?>
Тема «Помогите решить вопрос с хлебными крошками» закрыта для новых ответов.