0

как правильно добавить ссылку и текст на Категорию записи в таком коде

<div class="entry-meta">
            <?php if ( ! is_page() ) : ?>
                <a href="<?php echo esc_url( $author_posts_url ); ?>" title="<?php echo esc_attr( $posts_by_title ); ?>" class="entry-author"><?php the_author(); ?></a>
            <?php endif; ?>
            <span class="entry-date">
                <?php breathe_date_time_with_microformat(); ?>
            </span>
            <span class="entry-actions">
                <?php do_action( 'breathe_post_actions' ); ?>
            </span>
            <?php if ( is_object_in_taxonomy( get_post_type(), 'post_tag' ) ) : ?>
                <span class="entry-tags">
                    <?php breathe_tags_with_count( '', __( '<br />Теги:' , 'p2-breathe' ) .' ', ', ', ' &nbsp;' ); ?>&nbsp;
                </span>
            <?php endif; ?>

            <?php do_action( 'breathe_header_entry_meta' ); ?>
        </div><!-- .entry-meta -->

1 ответ 1

0

Используйте такой код:

<?php
$term = get_queried_object();
$term_name = apply_filters( 'single_cat_title', $term->name );
$term_link = get_term_link( $term );
?>
<span class="entry-cat">
    <a href="<?php echo esc_url( $term_link ); ?>" title="<?php echo esc_attr( $term_name ); ?>" class="entry-cat-link"><?php echo esc_html( $term_name ); ?></a>
</span>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.