This repository has been archived on 2024-04-03. You can view files and clone it, but cannot push or open issues or pull requests.
qdouze2-wordpress-theme/components/article/terms.php

30 lines
1.4 KiB
PHP
Raw Normal View History

<h3 class="sr-only">Tags et catégories</h3>
2022-12-17 19:46:29 +01:00
<?php
if (has_category('chapters')) {
echo "<ul class='nolist' aria-labelledby='title-article-taxo-romans'>";
echo '<h4 class="sr-only" id="title-article-taxo-romans">Romans</h4>';
2022-12-17 19:46:29 +01:00
$romans = get_the_terms($post->ID, 'roman');
foreach( $romans as $roman ) {
echo "<li><a href= '" . esc_url( get_category_link( $roman->term_id ) ) . "' class='badge btn-primary'><i class='icon-book'></i>&nbsp;" . $roman->name . "</a></li>";
2022-12-17 19:46:29 +01:00
}
echo "</ul>";
2022-12-17 19:46:29 +01:00
} else {
$categories = get_the_category();
echo "<ul class='nolist' aria-labelledby='title-article-taxo-categories'>";
echo '<h4 class="sr-only" id="title-article-taxo-categories">Catégories</h4>';
2022-12-17 19:46:29 +01:00
foreach( $categories as $category ) {
echo "<li><a href= '" . esc_url( get_category_link( $category->term_id ) ) . "' class='badge btn-primary'><i class='icon-folder'></i>&nbsp;" . $category->cat_name . "</a></li>";
2022-12-17 19:46:29 +01:00
}
echo "</ul>";
2022-12-17 19:46:29 +01:00
}
$tags = get_the_tags();
if ($tags) {
echo "<ul class='nolist' aria-labelledby='title-article-taxo-tags'>";
echo '<h4 class="sr-only" id="title-article-taxo-tags">Tags</h4>';
2022-12-17 19:46:29 +01:00
foreach( $tags as $tag ) {
echo "<li><a href= '" . esc_url( get_tag_link( $tag->term_id ) ) . "' class='badge btn-secondary'><i class='icon-tag'></i>&nbsp;" . $tag->name . "</a></li>";
2022-12-17 19:46:29 +01:00
}
echo "</ul>";
2022-12-17 19:46:29 +01:00
}
?>