Fix comment anchor outside posts

This commit is contained in:
Tetrakern 2023-08-10 01:34:45 +02:00
parent abf3a11c28
commit 1bef82b3e6

View File

@ -1218,11 +1218,13 @@ if ( ! function_exists( 'fictioneer_get_post_meta_items' ) ) {
// Comments node
if ( ! $no_comments && $comments_number > 0 ) {
$comments_link = is_single() ? '#comments' : get_the_permalink() . '#comments';
ob_start();
// Start HTML ---> ?>
<div class="post__comments-number">
<i class="fa-solid fa-message"></i>
<a href="#comments"><?php printf( _n( '%s Comment', '%s Comments', $comments_number, 'fictioneer' ), number_format_i18n( $comments_number ) ); ?></a>
<a href="<?php echo $comments_link; ?>"><?php printf( _n( '%s Comment', '%s Comments', $comments_number, 'fictioneer' ), number_format_i18n( $comments_number ) ); ?></a>
</div>
<?php // <--- End HTML
$output['comments'] = ob_get_clean();