diff --git a/assets/js/clipboard.js b/assets/js/clipboard.js new file mode 100644 index 0000000..989bc67 --- /dev/null +++ b/assets/js/clipboard.js @@ -0,0 +1,22 @@ +document.addEventListener("DOMContentLoaded", function () { + const doiLink = document.getElementById("doi-link"); + const doiCopyMessage = document.getElementById("doi-copy-message"); + + doiLink.addEventListener("click", function (event) { + event.preventDefault(); + const doi = doiLink.getAttribute("data-doi"); + const fullDoiUrl = `${window.location.origin}/${doi}`; + + navigator.clipboard.writeText(fullDoiUrl).then( + function () { + doiCopyMessage.style.display = "inline"; + setTimeout(function () { + doiCopyMessage.style.display = "none"; + }, 2000); + }, + function () { + alert("Failed to copy DOI to clipboard."); + } + ); + }); +}); diff --git a/single-article.php b/single-article.php index 2f5f78a..505ddd1 100644 --- a/single-article.php +++ b/single-article.php @@ -16,19 +16,23 @@ } ?>
- DOI: + DOI: + + + +
Status: name; - } - echo implode(', ', $term_list); - } - ?> + $terms = get_the_terms(get_the_ID(), 'publication_status'); + if (!empty($terms) && !is_wp_error($terms)) { + $term_list = array(); + foreach ($terms as $term) { + $term_list[] = $term->name; + } + echo implode(', ', $term_list); + } + ?>
@@ -40,4 +44,6 @@ + + \ No newline at end of file