Site logo

Archived topic

Possible to put anchor text/link beside date?

5 replies · Started by Carol on October 7, 2019

Viewing posts 1–6 of 6

In this theme, is it possible to add a phrase that's hyperlinked to comments beside the date?

Like this:

Thank you.

X80Ws+031v45

Hi there,

Try this PHP snippet:

add_filter( 'generate_post_date_output', function( $output ) {
    echo $output;

    if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
        echo '<span class="comments-link">';
            comments_popup_link( __( '0 comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) );
        echo '</span>';
    }
} );

Adding PHP: https://docs.generatepress.com/article/adding-php/

Let me know if this helps :)

Great!

Can I make the text bold?

I edited the text, but how to make it bold?

add_filter( 'generate_post_date_output', function( $output ) {
echo $output;

if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '<span class="comments-link">';
comments_popup_link( __( '0 comment', 'generatepress' ), __( ' Leave a Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) );
echo '</span>';
}
} );

Edit this block of existing CSS:

.tags-links a, .cat-links a {
    font-weight: 600;
}

to this:

.tags-links a, .cat-links a, .comments-link a {
    font-weight: 600;
}

You're the Best!

Thank you so much!

:-)

No problem :)

This archived topic is closed to new replies.