Tagged: nofollow
-
AuthorPosts
-
June 22, 2016 at 6:25 pm #652328
We have a bunch of outgoing links in the partner/logo element. We need to add the attribute rel=”nofollow” to all links.
I tried looking in the module but cant find any way to add html code like rel=”nofollow”.June 22, 2016 at 10:26 pm #652397Hey belinger!
function add_custom_script(){ ?> <script> $( document ).ready(function() { $('body > a').attr("rel", "nofollow"); }); </script> <?php } add_action('wp_footer', 'add_custom_script');
Add that code to your functions.php file and replace the body > a with the class you want it to have.
Do let us know if it works for you as needed.Regards,
BasilisJune 23, 2016 at 7:03 pm #652680Thanks for your reply. I have tried to figure out what to replace body > a with. I cant get it working. I provided link and further details in private area:
June 28, 2016 at 2:43 am #654020Hi,
Please try this code instead:
// custom script add_action('wp_footer', 'ava_custom_script'); function ava_custom_script(){ ?> <script type="text/javascript"> (function($) { function a() { $('#top .avia-logo-element-container .slide-image').each(function() { $(this).attr('rel', 'nofollow'); }); } a(); })(jQuery); </script> <?php }
Best regards,
IsmaelJuly 16, 2017 at 11:08 pm #822214Hi Ismael,
I tried this solution to make my logo link nofollow, and it appears in the code but still follow for Nofollow checker tools.
I share you on Private Content the custom code I added to the functions.php files and how it looks like on the Chrome console.Thank you for your help.
BR,
July 17, 2017 at 3:42 pm #822692Hi PaddleSurfEs,
This line has to target the link, not the span and the function a() has to be :)
function a() { $('#top .logo a').attr('rel', 'nofollow'); }
If you need further assistance please let us know.
Best regards,
VictoriaJuly 17, 2017 at 11:36 pm #823004Hi Victoria,
Thank you for your answer but I´m such a newbie and I´m lost :( I share you in private content the website URL and logo span code. Should you please adapt the custom code to make it works with my logo?
Thanks in advance for your help.
Florian
July 19, 2017 at 3:55 pm #824041Hi Florian,
The no-follow has to be on the link (https://www.w3schools.com/tags/att_a_rel.asp), it is there now, in the correct location.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.