1

In http://www.onlineincomestartup.com/drive-traffic-to-your-website/ , In the author bio that shows up inside each posts, nofollow image

I need to make all the links except Google plus, a no follow for SEO purposes.I am using a plugin called WP about author.I guess I need to make changes to the following code.But I'm not that good in editing codes.someone please help.thanks

// Generate social icons
function wp_about_author_get_social_links($wp_about_author_settings){
    $content="";
    $socials = wp_about_author_get_socials();
    foreach($socials as $social_key=>$social){
        if (get_the_author_meta($social_key)){
            if(isset($wp_about_author_settings['wp_author_social_images']) && $wp_about_author_settings['wp_author_social_images']){
                $content .= "<a class='wpa-social-icons' rel="nofollow" href='".str_replace('%%username%%', get_the_author_meta($social_key), $social['link'])."'><img src='". $social['icon']."' alt='".$social['title']."'/></a>";
            } else {
                if($content != "")
                    $content .= apply_filters( 'wp_about_author_separator', " - ");
                $content .= "<a href='".str_replace('%%username%%', get_the_author_meta($social_key), $social['link'])."'>".$social['title']."</a>";
            }
        }
    }
    return $content;
}

function wp_about_author_get_socials() {
    $socials = array();
    $socials['twitter'] = array('title'=>'Twitter', 'link'=>'http://www.twitter.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/twitter.png');
    $socials['facebook'] = array('title'=>'Facebook', 'link'=>'http://www.facebook.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/facebook.png');
    $socials['linkedin'] = array('title'=>'LinkedIn', 'link'=>'http://www.linkedin.com/in/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/linkedin.png');
    $socials['pinterest'] = array('title'=>'Pinterest', 'link'=>'http://www.pinterest.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/pinterest.png');
    $socials['googleplus'] = array('title'=>'Google Plus', 'link'=>'https://plus.google.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/googleplus.png');
    $socials['digg'] = array('title'=>'Digg', 'link'=>'http://www.digg.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/digg.png');
    $socials['flickr'] = array('title'=>'Flickr', 'link'=>'http://www.flickr.com/people/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/flickr.png');
    $socials['stumbleupon'] = array('title'=>'StumbleUpon', 'link'=>'http://www.stumbleupon.com/stumbler/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/stumbleupon.png');
    $socials['youtube'] = array('title'=>'YouTube', 'link'=>'http://www.youtube.com/user/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/youtube.png');
    $socials['yelp'] = array('title'=>'Yelp', 'link'=>'http://www.yelp.com/user_details?userid=%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/yelp.png');
    $socials['reddit'] = array('title'=>'Reddit', 'link'=>'http://www.reddit.com/user/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/reddit.png');
    $socials['delicious'] = array('title'=>'Delicious', 'link'=>'http://www.delicious.com/%%username%%', 'icon'=> WPAUTHORURL_URL .'/images/delicious.png');
    return apply_filters( 'wp_about_author_get_socials', $socials );
}

2 Answers2

1

You can change this line where the username link is generated

$content .= "<a href='".str_replace('%%username%%', get_the_author_meta($social_key), $social['link'])."'>".$social['title']."</a>";

to

$content .= "<a rel='nofollow' href='".str_replace('%%username%%', get_the_author_meta($social_key), $social['link'])."'>".$social['title']."</a>";

and that should add nofollow to your links.

Ronan
  • 821
  • 12
  • 30
  • 1
    Thanks!! That worked .But I need to make all the links except Google plus, a no follow.This is working for all the links.I don't Need that.Any suggestions ? –  Feb 12 '14 at 10:29
0

I had the same requirement. I had social links and icons on my site and found that our website was passing off thousands of dofollow links and draining our sites link juice. After some research I came across a nice little feature in Rank Maths SEO plugin that would allow you to actually select certain domains and set them to nofollow site wide. This was really handy. However if you are already using yoast you will need to make sure you turn all of the Rank Math plugins features off and only use the nofollow domains options.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Matthew
  • 1
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). –  Oct 14 '21 at 14:58
  • I had the same requirement. Did your site get a penalty and this is why you want to nofollow everything? Just make sure you are not nofollowing your internal links also – Matthew Oct 14 '21 at 11:16