FEATURE Adapting content meta to handle dynamiques posts

This commit is contained in:
Antoine M 2026-05-13 11:57:54 +02:00
parent e9bc938e20
commit fe14cc2ad2

View File

@ -3,20 +3,31 @@ $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 = get_post_type_supports_type($current_post_type);
$is_dynamiques_post_type = $current_post_type === 'revues' || $current_post_type === 'articles';
$hasNumerotation = hasPostTypeNumerotation($current_post_type);
if ($current_post_type_supports_type) {
if ($is_dynamiques_post_type) {
$current_post_type_obj = get_post_type_object($current_post_type);
$dynamiques_post_type_labels = array(
'revues' => __('Revue', 'carhop'),
'articles' => __('Article', 'carhop'),
);
$type = $current_post_type_obj->labels->singular_name ?? $dynamiques_post_type_labels[$current_post_type] ?? null;
}
else if ($current_post_type_supports_type) {
// $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;
}
// $current_post_type === 'analyses-etudes' && is_array($type) && !empty($type) && isset($type[0]->name
} else {
}
else {
$current_post_type_obj = get_post_type_object($current_post_type);
$type = $current_post_type_obj->labels->singular_name;
$type = $current_post_type_obj->labels->singular_name ?? null;
}
?>
@ -28,8 +39,6 @@ if ($current_post_type_supports_type) {
<?php if ($hasNumerotation) : ?>
<?php
$numerotation = get_current_post_numerotation($current_post_id);
?>
<p class="content-meta__revue-issue content-meta__revue-issue--green">