-1

The small banners loaded on the site of the page does not have the rel="nofollow" attribute - and we would like this to be added.

http://poltr.com/?s=dans&post_type=aktivitet is the link, you can see the sidebar banners, they are curently set to:

just an example:

<a onclick="ga('send', 'event', 'koebenhavn', 'click', 'DYNAMIC URL' );" href="DYNAMIC URL"><img alt="" src="DYNAMIC IMG PATH"></a>  

I want them to be changed to:

<a rel="nofollow" onclick="ga('send', 'event', 'koebenhavn', 'click', 'DYNAMIC URL' );" href="DYNAMIC URL"><img alt="" src="DYNAMIC IMG PATH"></a>

Basically I want to add rel="nofollow" to links of sidebar banners only.

Also i don't want to use Plugin.

blunor
  • 49
  • 1
  • 6
  • use `$(object).attr("rel","nofollow");` – Parth Trivedi Jan 07 '16 at 09:31
  • That's realtively simple to add attribute to specific anchors inside container but you didn't provided any relevant HTML markup regarding the banner container and anyway, this should be done server side, before rendering HTML – A. Wolff Jan 07 '16 at 09:31
  • @A.Wolff Yes, As it have to done at server side as it has to done in wordpress. – Parth Trivedi Jan 07 '16 at 09:33
  • I am learning wordpress and it's functions, can you please guide where it will be added. – blunor Jan 07 '16 at 09:34
  • you need to find the sidebar template in theme directory and add the attribute – Yaroslav Grishajev Jan 07 '16 at 09:44
  • i didn't have an idea where to add this attribute and where to find sidebar template in directory, that is why I came to experts so they can help me. I only have access to website through FTP. – blunor Jan 07 '16 at 10:04
  • At some point someone will have to write some code to fix this. If you can't then contact your them e support. – James Jones Jan 07 '16 at 13:31

1 Answers1

1

This can be done by simple javascript code

$( document ).ready(function() {
        $('body > a').attr('rel','nofollow')
    });

Add this to your footer.php file this will add attribute to all tags.

Or can be done by using ID's for particular a tags

$( document ).ready(function() {
        $('body > a#ID_OF_A_TAG').attr('rel','nofollow')
    });

Hope this will do

Prakash Rao
  • 2,368
  • 1
  • 9
  • 12