FEATURE Handling different type display for multiple post types

This commit is contained in:
Antoine M 2026-03-03 17:02:46 +01:00
parent 7d9e53a076
commit 0045513e8e
2 changed files with 6 additions and 3 deletions

View File

@ -19,6 +19,7 @@
@apply rounded-full bg-white border-2 border-primary;
}
&--articles:before,
&--activites:before,
&--article:before {
@apply w-6 bg-carhop-purple-300 -rotate-45;
}

View File

@ -2,11 +2,14 @@
$current_post_id = $args['current_post_id'] ?? get_the_ID();
$current_post_type = $args['current_post_type'] ?? null;
$type = null;
$current_post_type_supports_type = is_object_in_taxonomy($current_post_type, 'type');
$current_post_type_supports_type = get_post_type_supports_type($current_post_type);
$hasNumerotation = hasPostTypeNumerotation($current_post_type);
if ($current_post_type_supports_type) {
$type_term = get_the_terms($current_post_id, 'type')[0] ?? null;
// $type = isset($types_terms[0]) ? $types_terms[0] : null;
$type_term = get_post_specific_type_terms($current_post_id)[0] ?? null;
if ($type_term) {
$type = $type_term->name;
}
@ -17,7 +20,6 @@ if ($current_post_type_supports_type) {
}
?>
<div class="content-meta">
<?php if ($type) : ?>
<span class="content-meta__type content-meta__type--<?php echo $current_post_type ?>"><?php echo $type ?></span>