Nofollow author box social links

I actually can’t see the previous code so I’m not sure what was suggested!

But yes, the code I pasted will take care of it.

No, it didn’t work sorry.

Attaching link to pastebin to view a copy of my functions.php file with your code included…

Hello Chris,

Please update the code and use this instead:

function x_shortcode_author_v2( $atts ) {
  extract( shortcode_atts( array(
    'id'        => '',
    'class'     => '',
    'style'     => '',
    'title'     => '',
    'author_id' => ''
  ), $atts, 'x_author' ) );
  $id        = ( $id        != '' ) ? 'id="' . esc_attr( $id ) . '"' : '';
  $class     = ( $class     != '' ) ? 'x-author-box cf ' . esc_attr( $class ) : 'x-author-box cf';
  $style     = ( $style     != '' ) ? 'style="' . $style . '"' : '';
  $title     = ( $title     != '' ) ? $title : csi18n('shortcodes.author-title');
  $author_id = ( $author_id != '' ) ? $author_id : get_the_author_meta( 'ID' );
  $description  = get_the_author_meta( 'description', $author_id );
  $display_name = get_the_author_meta( 'display_name', $author_id );
  $facebook     = get_the_author_meta( 'facebook', $author_id );
  $twitter      = get_the_author_meta( 'twitter', $author_id );
  $googleplus   = get_the_author_meta( 'googleplus', $author_id );
  
  $facebook_title   = sprintf( __('Visit the Facebook Profile for %s', '__x__'), $display_name);
  $twitter_title    = sprintf( __('Visit the Twitter Profile for %s', '__x__'), $display_name);
  $googleplus_title = sprintf( __('Visit the Google+ Profile for %s', '__x__'), $display_name);
  $facebook_output   = ( $facebook )   ? '<a rel="nofollow" href="{$facebook}" class="x-author-social" title="{$facebook_title}" target="_blank"><i class="x-icon-facebook-square" ' . fa_data_icon('facebook') . '></i> Facebook</a>' : '';
  $twitter_output    = ( $twitter )    ? '<a rel="nofollow" href="{$twitter}" class="x-author-social" title="{$twitter_title}" target="_blank"><i class="x-icon-twitter-square" ' . fa_data_icon('twitter-square') . '></i> Twitter</a>' : '';
  $googleplus_output = ( $googleplus ) ? '<a rel="nofollow" href="{$googleplus}" class="x-author-social" title="{$googleplus_title}" target="_blank"><i class="x-icon-google-plus-square" ' . fa_data_icon('google-plus-square') . '></i> Google+</a>' : '';
  $output = '<div {$id} class="{$class}" {$style}>'
            . '<h6 class="h-about-the-author">{$title}</h6>'
            . get_avatar( $author_id, 180 )
            . '<div class="x-author-info">'
              . '<h4 class="h-author mtn">{$display_name}</h4>'
                . $facebook_output
                . $twitter_output
                . $googleplus_output
              . '<p class="p-author mbn">{$description}</p>'
            . '</div>'
          . '</div>';
  return $output;
}


add_filter('wp_head', 'no_follow_author');

function no_follow_author() {
  remove_shortcode( 'x_shortcode_author' );  
  add_shortcode( 'x_shortcode_author', 'x_shortcode_author_v2' );

}

We would loved to know if this has work for you. Thank you.

Nope, still didn’t work. lol

Code has been updated in the pastebin file to show what is there now.

Would it be affected by some custom CSS placed on the site previously that was to do with the author box? https://theme.co/apex/forum/t/author-box-text-hardly-visible/41012

Hello Chris,

Have the code updated and use this:

function x_shortcode_author_v2( $atts ) {
  extract( shortcode_atts( array(
    'id'        => '',
    'class'     => '',
    'style'     => '',
    'title'     => '',
    'author_id' => ''
  ), $atts, 'x_author' ) );
  $id        = ( $id        != '' ) ? 'id="' . esc_attr( $id ) . '"' : '';
  $class     = ( $class     != '' ) ? 'x-author-box cf ' . esc_attr( $class ) : 'x-author-box cf';
  $style     = ( $style     != '' ) ? 'style="' . $style . '"' : '';
  $title     = ( $title     != '' ) ? $title : csi18n('shortcodes.author-title');
  $author_id = ( $author_id != '' ) ? $author_id : get_the_author_meta( 'ID' );
  $description  = get_the_author_meta( 'description', $author_id );
  $display_name = get_the_author_meta( 'display_name', $author_id );
  $facebook     = get_the_author_meta( 'facebook', $author_id );
  $twitter      = get_the_author_meta( 'twitter', $author_id );
  $googleplus   = get_the_author_meta( 'googleplus', $author_id );
  
  $facebook_title   = sprintf( __('Visit the Facebook Profile for %s', '__x__'), $display_name);
  $twitter_title    = sprintf( __('Visit the Twitter Profile for %s', '__x__'), $display_name);
  $googleplus_title = sprintf( __('Visit the Google+ Profile for %s', '__x__'), $display_name);
  $facebook_output   = ( $facebook )   ? '<a rel="nofollow" href="{$facebook}" class="x-author-social" title="{$facebook_title}" target="_blank"><i class="x-icon-facebook-square" ' . fa_data_icon('facebook') . '></i> Facebook</a>' : '';
  $twitter_output    = ( $twitter )    ? '<a rel="nofollow" href="{$twitter}" class="x-author-social" title="{$twitter_title}" target="_blank"><i class="x-icon-twitter-square" ' . fa_data_icon('twitter-square') . '></i> Twitter</a>' : '';
  $googleplus_output = ( $googleplus ) ? '<a rel="nofollow" href="{$googleplus}" class="x-author-social" title="{$googleplus_title}" target="_blank"><i class="x-icon-google-plus-square" ' . fa_data_icon('google-plus-square') . '></i> Google+</a>' : '';
  $output = '<div {$id} class="{$class}" {$style}>'
            . '<h6 class="h-about-the-author">{$title}</h6>'
            . get_avatar( $author_id, 180 )
            . '<div class="x-author-info">'
              . '<h4 class="h-author mtn">{$display_name}</h4>'
                . $facebook_output
                . $twitter_output
                . $googleplus_output
              . '<p class="p-author mbn">{$description}</p>'
            . '</div>'
          . '</div>';
  return $output;
}


add_filter('wp_head', 'no_follow_author');
function no_follow_author() {
  remove_shortcode( 'x_author' );  
  add_shortcode( 'x_author', 'x_shortcode_author_v2' );
}

Meanwhile, I noticed that you are using WP Rocket and the page, JS and CSS files were minified. Please clear your cache first. I also noticed that you are using CloudFlare. Please login to your CloudFlare account and purge your site cache as well.

Please let us know how it goes.

Hi again,

That has changed the links to nofollow, but the rest of the author box has disappeared completely.

Hello Chris,

Update the code again and use this:

function x_shortcode_author_v2( $atts ) {
  extract( shortcode_atts( array(
    'id'        => '',
    'class'     => '',
    'style'     => '',
    'title'     => '',
    'author_id' => ''
  ), $atts, 'x_author' ) );

  $id        = ( $id        != '' ) ? 'id="' . esc_attr( $id ) . '"' : '';
  $class     = ( $class     != '' ) ? 'x-author-box cf ' . esc_attr( $class ) : 'x-author-box cf';
  $style     = ( $style     != '' ) ? 'style="' . $style . '"' : '';
  $title     = ( $title     != '' ) ? $title : csi18n('shortcodes.author-title');
  $author_id = ( $author_id != '' ) ? $author_id : get_the_author_meta( 'ID' );

  $description  = get_the_author_meta( 'description', $author_id );
  $display_name = get_the_author_meta( 'display_name', $author_id );
  $facebook     = get_the_author_meta( 'facebook', $author_id );
  $twitter      = get_the_author_meta( 'twitter', $author_id );
  $googleplus   = get_the_author_meta( 'googleplus', $author_id );
  
  $facebook_title   = sprintf( __('Visit the Facebook Profile for %s', '__x__'), $display_name);
  $twitter_title    = sprintf( __('Visit the Twitter Profile for %s', '__x__'), $display_name);
  $googleplus_title = sprintf( __('Visit the Google+ Profile for %s', '__x__'), $display_name);

  $facebook_output   = ( $facebook )   ? "<a rel="nofollow" href=\"{$facebook}\" class=\"x-author-social\" title=\"{$facebook_title}\" target=\"_blank\"><i class=\"x-icon-facebook-square\" " . fa_data_icon('facebook') . "></i> Facebook</a>" : '';
  $twitter_output    = ( $twitter )    ? "<a rel="nofollow" href=\"{$twitter}\" class=\"x-author-social\" title=\"{$twitter_title}\" target=\"_blank\"><i class=\"x-icon-twitter-square\" " . fa_data_icon('twitter-square') . "></i> Twitter</a>" : '';
  $googleplus_output = ( $googleplus ) ? "<a rel="nofollow" href=\"{$googleplus}\" class=\"x-author-social\" title=\"{$googleplus_title}\" target=\"_blank\"><i class=\"x-icon-google-plus-square\" " . fa_data_icon('google-plus-square') . "></i> Google+</a>" : '';

  $output = "<div {$id} class=\"{$class}\" {$style}>"
            . "<h6 class=\"h-about-the-author\">{$title}</h6>"
            . get_avatar( $author_id, 180 )
            . '<div class="x-author-info">'
              . "<h4 class=\"h-author mtn\">{$display_name}</h4>"
                . $facebook_output
                . $twitter_output
                . $googleplus_output
              . "<p class=\"p-author mbn\">{$description}</p>"
            . '</div>'
          . '</div>';

  return $output;
}


add_filter('wp_head', 'no_follow_author');
function no_follow_author() {
  remove_shortcode( 'x_author' );  
  add_shortcode( 'x_author', 'x_shortcode_author_v2' );
}

If this does not resolve the issue, please provide us access to your site so that we can fixed it instead. You can add the credentials in a secure note in your next reply. To know how to create a secure note, please check this out: https://theme.co/apex/forum/t/how-to-get-support/288

Please let us know how it goes.

That just broke the site completely.

I got this message:

Parse error: syntax error, unexpected ‘nofollow’ (T_STRING) in /home/******/public_html/wp-content/themes/pro-child/functions.php on line 44

Line 44 was this:

$facebook_output = ( $facebook ) ? "<a rel="nofollow" href=\"{$facebook}\" class=\"x-author-social\" title=\"{$facebook_title}\" target=\"_blank\">

Hi,

You may use this email. Please provide us your ftp login as well in Secure Note

Thanks

Link below…

Hi ,

Please provide us your ftp username as well.

Thanks

Added above, thank you!

Hey Chris,

I tried to login through FTP using the details you have provided but they don’t seem to work.

Would you mind double checking the details and provide us with a working access so that we can check it?

Thank you.

Added new details, hope that helps. :-/

Hi,

The themeco login works but doesn’t have the right access.
When I logged in, I can only see a blank directory and not wordpress fies.

Please check again and let us know.

Thanks

Probably easier to just go in the front door…

Hello Chris,

We have logged in successfully and were able to resolve the issue. The author social links is now using “no follow”.

Best Regards.

Brilliant, thank you very much. :slight_smile:

You are most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.