feat(article): add display of article keywords

Introduced functionality to display article keywords on single article pages by retrieving metadata and rendering it alongside the abstract. This enriches article content with relevant keyword information, enhancing SEO and user navigation.
This commit is contained in:
Kumi 2024-09-17 15:54:00 +02:00
parent a5bcb0342b
commit 81d567447b
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -27,7 +27,12 @@
<?php if (has_excerpt()) : ?>
<p class="text-muted"><strong>Abstract:</strong> <?php echo get_the_excerpt(); ?></p>
<?php endif; ?>
<?php
$keywords = get_post_meta(get_the_ID(), 'article_keywords', true);
if (!empty($keywords)) :
echo '<p class="text-muted"><strong>Keywords:</strong> ' . implode(', ', array_map('esc_html', $keywords)) . '</p>';
endif;
?>
<?php
$attachment_id = get_post_meta(get_the_ID(), 'article_attachment_id', true);
$attachment_url = $attachment_id ? esc_url(home_url('/download/' . $attachment_id)) : '';