Add a tag to the author name link on post pages?
-
Hello,
I just noticed that the rel=”author” tag was removed from the author name links on post pages during one of the recent Graphene updates. It still appears on category and tag pages, but I would like it on post pages as well. Can anyone provide me with a code snippet to add to my child theme functions.php file to add it back in. Thanks 🙂
Hello??
Not sure when or why it was removed. I’m not even sure if it was there! Syahir?
You can still add
rel="author"
for post author profile link by editingloop-single.php
. Replace$author_url = '<a href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '" class="url">' . get_the_author_meta( 'display_name' ) . '</a>';
(93rd line) with
$author_url = '<a href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '" class="url" rel="author">' . get_the_author_meta( 'display_name' ) . '</a>';
If you don’t want to edit parent theme files (and you shouldn’t), hide post author in Graphene Options and add this to child-theme’s functions.php (untested, should work though)
function my_author_link_with_rel() {
?>
<p class="post-author author vcard">
<?php
$author_url = '<a href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '" class="url" rel="author">' . get_the_author_meta( 'display_name' ) . '</a>';
printf( __( 'by %s', 'graphene' ), '<span class="fn nickname">' . $author_url . '</span>' );
?>
</p>
<?php
}
add_action('graphene_post_meta','my_author_link_with_rel');It was definitely there at one time. I remember it clearly because I used Google’s suggestion of using rel=”author” on post pages and rel=”me” on the author page to verify authorship of my posts. When I checked to see if the rel=”author” tag was in the post author links I was pleasantly surprised that it was already there. Please add it back on the next theme update 🙂
I will update you again when I have added your suggestion. Could this come back to haunt me in future theme updates?
ModNot if you are using a child theme.
If it does get added back, you can just delete the appropriate function and action from your functions file.
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.