Hello!
How can I add the rel=”nofollow” attribute to the buy buttons on the product pages?
I have been trying for a while to have Google not index my affiliate links.
I have tried to cloak the links with plugins as Thirsty Affiliates Affiliate link cloaker for WordPress. and I have tried the recommended way by yoast SEO among many others… besides that these plugins do not work and google continues to index these links and damaging SEO, for me to cloak the links is not a recommended practice since you can fall into penalties and I do not like to hide the links to users.
that’s why I prefer add only the rel=”nofollow” attribute but when i tested all these Nofollow plugins (Ultimate Nofollow, Nofollow for External Link, Follow Nofollow Control) as recommended by Google’s Matt Cutts, they work but not on the buttons on the product pages…
Is there any way to add a function to do not follow these buttons?
http://www.dinosaurios.tienda/comprar/dinosaurios-carnivorosde-juguete/quetzalcoatlus/
attached screen: https://s33.postimg.cc/7lliwdt25/screen.jpg
Hey Ganubis,
Thank you for using Enfold.
This script should apply a rel attribute to the single add to cart buttons. Just add it in the functions.php file.
add_action('wp_footer', 'ava_add_rel_nofollow');
function ava_add_rel_nofollow(){
?>
<script type="text/javascript">
(function($) {
$('.single_add_to_cart_button').attr('rel', 'nofollow');
})(jQuery);
</script>
<?php
}
Best regards,
Ismael
Buauh, thank you very much!!!!!!
Now it is totally Nofollow:
<button type=”submit” class=”single_add_to_cart_button button alt” target=”_blank” rel=”nofollow”>COMPRAR</button>
I was going crazy to try a thousand plugins and things
a million thanks!!!! +10
Hi,
I’m glad you were able to get this resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon