Archived topic
Making author link on posts not clickable
7 replies · Started by Kevin Wabiszewski on March 4, 2019
Hello, is there a way to make the author's name and the date on posts not clickable?
Thanks again for your help.
Hi there,
See the last examples in these links:
https://docs.generatepress.com/article/generate_post_author_output/
https://docs.generatepress.com/article/generate_post_date_output/
Adding PHP: https://docs.generatepress.com/article/adding-php/
Let me know if this helps :)
Hi Leo, if this is too much to ask don't worry about it. I know this doesn't really fall into the scope of support but I tried adding that code and it did add the unclickable author name and date, but there were 2 of them since I am currently using this code. I think some of the fields as slightly different.
add_filter( 'generate_post_author', '__return_false' );
add_filter( 'generate_post_date_output', function( $date ) {
printf(
'<span class="meta-gravatar">%s</span>',
get_avatar( get_the_author_meta( 'ID' ) )
);
echo '<span class="meta-data">';
printf( ' <span class="byline">%1$s</span>',
sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author"><span class="author-name" itemprop="name">%3$s</span></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() )
)
);
echo $date;
echo '</span>';
} );
Hi there,
you can disable the pointer events using this CSS:
.byline .author a {
pointer-events: none;
}
Thanks guys!
You're welcome - glad we could be of help
Then just
.posted-on a {
pointer-events: none;
}
To disable the date link right?
thats correct