Using the Social fields in the SEO Plugin, we don't have to enter this data into the theme too:
/**
* Use Yoast SEO Plugin to create these constants
* http://wordpress.org/plugins/wordpress-seo/
* https://gist.github.com/germanny/6222479
*/
if ( function_exists( 'get_wpseo_options' ) ) {
$get_options_wpseo_social = get_option('wpseo_social');
define('TWITTER_USERNAME', $get_options_wpseo_social['twitter_site']);
define('FB_PAGE', $get_options_wpseo_social['facebook_site']);
$plus_author_link = get_user_meta($get_options_wpseo_social['plus-author'], 'googleplus', TRUE);
$plus_author_link = ( substr($plus_author_link, -1) == '/' ) ? $plus_author_link . '?rel=author' : $plus_author_link . '/?rel=author';
define('GOOGLE_PLUS_AUTHOR', $plus_author_link);
$plus_publisher_link = $get_options_wpseo_social['plus-publisher'];
$plus_publisher_link = ( substr($plus_publisher_link, -1) == '/' ) ? $plus_publisher_link . '?rel=publisher' : $plus_publisher_link . '/?rel=publisher';
define('GOOGLE_PLUS_PUBLISHER', $plus_publisher_link);
} else {
define('TWITTER_USERNAME', '');
define('FB_PAGE', '');
define('GOOGLE_PLUS_AUTHOR', '');
define('GOOGLE_PLUS_PUBLISHER', '');
}
For proper G+ linking for Google searches, we need the following links in these places:
Author:
- User profile = author's G+ link
SEO Plugin Social Tab:
- Author for Homepage: Select blog author (with G+ link)
- Google Publisher Page = OnlineMBA G+ Account link