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

27 lines
1.2 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')) {
2023-11-24 20:23:34 +01:00
echo "<ul class='nolist' aria-label='Romans'>";
2022-12-17 19:46:29 +01:00
$romans = get_the_terms($post->ID, 'roman');
foreach( $romans as $roman ) {
2023-11-20 13:05:35 +01:00
echo "<li><a href= '" . esc_url( get_category_link( $roman->term_id ) ) . "' class='btn btn-small c-primary'><svg class='icon' alt=''><use xlink:href='#icon-folder'></use></svg>&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();
2023-11-24 20:23:34 +01:00
echo "<ul class='nolist' aria-label='Catégories'>";
2022-12-17 19:46:29 +01:00
foreach( $categories as $category ) {
2023-11-20 13:05:35 +01:00
echo "<li><a href= '" . esc_url( get_category_link( $category->term_id ) ) . "' class='btn btn-small c-primary'><svg class='icon' alt=''><use xlink:href='#icon-folder'></use></svg>&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) {
2023-11-24 20:23:34 +01:00
echo "<ul class='nolist' aria-label='Tags'>";
2022-12-17 19:46:29 +01:00
foreach( $tags as $tag ) {
2023-11-20 13:05:35 +01:00
echo "<li><a href= '" . esc_url( get_tag_link( $tag->term_id ) ) . "' class='btn btn-small c-secondary'><svg class='icon' alt=''><use xlink:href='#icon-tags'></use></svg>&nbsp;" . $tag->name . "</a></li>";
2022-12-17 19:46:29 +01:00
}
echo "</ul>";
2022-12-17 19:46:29 +01:00
}
?>