Handling main authors, publication directors and showing hiding tags
This commit is contained in:
parent
257673bb2e
commit
ef0fafd101
|
|
@ -4,6 +4,8 @@ $current_post_type = $args['current_post_type'] ?? get_post_type();
|
|||
$title = get_the_title($ID);
|
||||
$showExcerpt = $args['show_excerpt'] ?? false;
|
||||
|
||||
$showTags = $args['showTags'] ?? true;
|
||||
|
||||
$excerpt = get_the_excerpt($ID);
|
||||
$link = get_the_permalink($ID);
|
||||
|
||||
|
|
@ -13,8 +15,14 @@ $thumbnail_url = get_the_post_thumbnail_url($ID) ?? null;
|
|||
$date = get_the_date('F Y', $ID);
|
||||
|
||||
$authors = get_field('authors', $ID);
|
||||
$has_main_author = get_field('has_main_author', $ID);
|
||||
$main_author = get_field('main_author', $ID);
|
||||
$editors = get_field('editors', $ID);
|
||||
|
||||
$has_publication_direction = get_field('has_publication_direction', $ID);
|
||||
$publication_directors = get_field('publication_directors', $ID);
|
||||
|
||||
|
||||
$numerotation = get_post_meta($ID, 'post_numerotation', true);
|
||||
$tags = get_the_terms($ID, 'etiquettes');
|
||||
|
||||
|
|
@ -44,12 +52,21 @@ $tags = get_the_terms($ID, 'etiquettes');
|
|||
|
||||
<?php if ($authors) : ?>
|
||||
<ul class="post-card__authors">
|
||||
<?php if ($has_main_author && $main_author) : ?>
|
||||
<li class="main-author"><?php echo $main_author->post_title; ?></li>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($authors as $author) : ?>
|
||||
<li class="author"><?php echo $author->post_title; ?></li>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($editors as $editor) : ?>
|
||||
<li class="editor"><?php echo $editor->post_title; ?></li>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ($has_publication_direction && $publication_directors) : ?>
|
||||
<?php foreach ($publication_directors as $publication_director) : ?>
|
||||
<li class="publication-director">Sous la direction de <?php echo $publication_director->post_title; ?></li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($editors) : ?>
|
||||
<li class="editor"><?php echo $editors; ?></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
|
@ -58,7 +75,7 @@ $tags = get_the_terms($ID, 'etiquettes');
|
|||
<?php the_post_thumbnail('medium'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($tags) : ?>
|
||||
<?php if ($showTags && $tags) : ?>
|
||||
<ul class="tag-list">
|
||||
<?php foreach ($tags as $tag) : ?>
|
||||
<li class="tag-list__tag"><?php echo $tag->name; ?></li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user