ThemeShaper Forums » Thematic

[closed]

Adding rel="author" to author link

(3 posts)
  • Started 2 years ago by rickdej
  • Latest reply from rickdej
  • This topic is not resolved
  1. rickdej
    Member

    Google is now offering a way for content authors to get recognized in their search index. They recommend adding the code attribute rel=”author” to anchor tags to author bio pages (see http://www.google.com/support/webmasters/bin/answer.py?answer=1229920 for details). I want to add this to all of the author links in my blog. I assume I will modify my child theme to do this, but I don’t know where this code modification would go. Can anyone give me a specific pointer? In case it’s not obvious, I am new to PHP. Thanks!

    Posted 2 years ago #
  2. you can override or filter, same as you would do for making any child theme change. go into the extensions folder (in this case extensions.php) and find what is generating the code you need to mod. then copy it into your child's functions.php, rename the function the childtheme_override_whatever() and hack away.

    function childtheme_override_postmeta_authorlink() {
    
    	    global $authordata;
    
    	    $authorlink = '<span class="meta-prep meta-prep-author">' . __('By ', 'thematic') . '</span>';
    	    $authorlink .= '<span class="author vcard">'. '<a class="url fn n" rel=”author” href="';
    	    $authorlink .= get_author_posts_url($authordata->ID, $authordata->user_nicename);
    	    $authorlink .= '" title="' . __('View all posts by ', 'thematic') . get_the_author_meta( 'display_name' ) . '">';
    	    $authorlink .= get_the_author_meta( 'display_name' );
    	    $authorlink .= '</a></span>';
    
    	    return apply_filters('thematic_post_meta_authorlink', $authorlink);
    
    	}

    untested, but that should do it.

    Posted 2 years ago #
  3. rickdej
    Member

    Helga, as usual, you are brilliant! Thank you! The only thing I needed to change in your sample code were the quotes used around the word author. They weren't legit ASCII quote characters. Thanks again for the speedy and very helpful reply!

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.