-
AuthorPosts
-
January 28, 2019 at 11:44 pm #1059839
Please, help!
1. Can be possible to make a link (going out of my website) unfollow in text and how?
2. Is a link to website owner (the person who leaves a comment) in the comments section, is unfollow?
Thank you so much in advance!January 29, 2019 at 3:44 pm #1060055Hey Gala,
1. Are you referring on a link to an external site to open in new tab or window? instead of opening in the same tab?
2. I’m not really sure what you mean with unfollow, can you give us more context?Best regards,
NikkoJanuary 30, 2019 at 7:02 pm #1060583Hello Nikko,
1. So sorry:) I mean nofollow. I am looking how to make an external link to other websites nofollow.
How to make external site link open in a new tab I know this option, it is easy to find. Love Enfold!
Thank you so much! GalaJanuary 31, 2019 at 4:47 am #1060711Hi Gala,
Try adding this php code in functions.php:
add_filter('the_content', 'my_nofollow'); add_filter('the_excerpt', 'my_nofollow'); function my_nofollow($content) { return preg_replace_callback('/<a[^>]+/', 'my_nofollow_callback', $content); } function my_nofollow_callback($matches) { $link = $matches[0]; $site_link = get_bloginfo('url'); if (strpos($link, 'rel') === false) { $link = preg_replace("%(href=\S(?!$site_link))%i", 'rel="nofollow" $1', $link); } elseif (preg_match("%href=\S(?!$site_link)%i", $link)) { $link = preg_replace('/rel=\S(?!nofollow)\S*/i', 'rel="nofollow"', $link); } return $link; }Best regards,
NikkoJanuary 31, 2019 at 7:46 pm #1061126Hi Nikko,
Thank you so much but I am not a big code person, so I need to learn more before use it. Thank you so much for your help! I really love Enfold!February 2, 2019 at 12:14 am #1061801Hi Gala,
Glad that we are able to help you :)
Feel free to create a new thread if you need more assistance.
Thanks for using Enfold and have a wonderful day ahead!Best regards,
Nikko -
AuthorPosts
- The topic ‘How To Make Link Unfollow? Please Help!’ is closed to new replies.
