Skip to content

Commit

Permalink
Add a test to prevent coauthors function firing if there is no author…
Browse files Browse the repository at this point in the history
…, as this generates an error.
  • Loading branch information
sbrody committed Nov 14, 2024
1 parent 90c1df8 commit 8cbe7e5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/byline.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ function gds_byline()
<span class="govuk-visually-hidden">Posted by: </span>
<?php
if (function_exists('coauthors_posts_links')) {
coauthors_posts_links(', ');
if (get_the_author()) {
coauthors_posts_links(', ');
}

} else {
?> <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')) ?>" rel="author" class="govuk-link"><?php echo get_the_author() ?></a> <?php
}
Expand Down

0 comments on commit 8cbe7e5

Please sign in to comment.