I have this code for generating links:
<div class="header-social">
<?php foreach( $mts_options['mts_header_social'] as $header_icons ) : ?>
<?php if( ! empty( $header_icons['mts_header_icon'] ) && isset( $header_icons['mts_header_icon'] ) ) : ?>
<a href="<?php print $header_icons['mts_header_icon_link'] ?>" class="header-<?php print $header_icons['mts_header_icon'] ?>" style="background: <?php print $header_icons['mts_header_icon_bg_color'] ?>" target="_blank"><span class="fa fa-<?php print $header_icons['mts_header_icon'] ?>"></span></a>
<?php endif; ?>
<?php endforeach; ?>
</div>
I would like to insert rel="nofollow" only in that case if a link is an external domain.
How can I proceed it? Can you help me?
Thanks so much
I can suggest something like this when generating the code, seems like a workaround:
if(substr($header_icons['mts_header_icon_link'], 0, 4) == "http"){echo "rel='nofollow'"; }
Let me know if it helps.