Try copying the following code into your functions.php file.
It adds a custom og:image property for the authors with nicenames of michelle-robinson
, mystery-man
, john-smith
, and a default fallback image, respectively. You can easily change this to suit your needs.
add_action( 'wp_head', 'wpse_70701_author_image' ); function wpse_70701_author_image() { if ( is_author( 'michelle-robinson' ) ) { // set a custom image if we're visiting Michelle Robinson's author page echo '<meta property="og:image" content="http://www.phoneographer.org/wp-content/uploads/link-to-michelle-robinson-image.png" />'; } elseif ( is_author( 'mystery-man' ) ) { // set a custom image if we're visiting Mystery Man's author page echo '<meta property="og:image" content="http://www.phoneographer.org/wp-content/uploads/link-to-mystery-man-image.png" />'; } elseif ( is_author( 'john-smith' ) ) { // set a custom image if we're visiting John Smith's author page echo '<meta property="og:image" content="http://www.phoneographer.org/wp-content/uploads/link-to-mystery-man-image.png" />'; } else { // set the default fallback image (you may want to omit this section) echo '<meta property="og:image" content="http://www.phoneographer.org/wp-content/uploads/link-to-author-image.png" />'; } }
Here, I’ve given the function a unique name, but you can call the function anything you want, as long as it is not already the name of another function. If you rename the function, you also need to edit the add_action
hook.