Tagged: nofollow
-
AuthorPosts
-
November 3, 2020 at 10:38 am #1257925
Hi, I would like to make my image link on the full width easy slider nofollow but I cannot work out how to do it. If it is easier, I am happy to make all external links nofollow. I tried a couple of plugins but they didn’t work. I tried editing the html in the default editor but it just corrupted the page.
Thanks for your help.November 7, 2020 at 2:07 pm #1259046Hey aliciapotts,
Sorry for the very late reply and thanks for the link to your site, I was not sure if you wanted to keep the current attributesnoopener noreferrer
and addnofollow
, if not please feel free to adjust the code below to suit.
I would recommend adding a custom ID to the slider so it will be easier if you want to use this on other pages, in the code below the ID is#full_slider_4
feel free to adjust the code to suit your custom ID.
Try adding this code to the end of your functions.php file in Appearance > Editor:function custom_script(){ ?> <script> (function($){ $(document).ready(function(){ $("#full_slider_4 a.avia-slide-wrap").attr("rel", "nofollow noopener noreferrer"); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
Then clear your browser cache and check.
Best regards,
MikeNovember 7, 2020 at 2:16 pm #1259049Hi,
I just noticed that there are more than one of these on the page so instead of adding a custom ID, please add a custom class and change the ID to your class like this:function custom_script(){ ?> <script> (function($){ $(document).ready(function(){ $(".custom_class a.avia-slide-wrap").attr("rel", "nofollow noopener noreferrer"); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
Best regards,
MikeNovember 20, 2020 at 4:20 am #1261706Hi Mike,
Thank you for the advice. I added the custom class ‘christmaswarehouse’ to all the ad sliders. Then I put the code below in the functions.php but the links don’t seem to be nofollow. Would you please advise where I went wrong? Thank you.
function custom_script(){
?>
<script>
(function($){
$(document).ready(function(){
$(“christmaswarehouse a.avia-slide-wrap”).attr(“rel”, “nofollow noopener noreferrer”);
});
})(jQuery);
</script>
<?php
}
add_action(‘wp_footer’, ‘custom_script’);November 20, 2020 at 3:15 pm #1261795Hi,
In your code the custom class ‘christmaswarehouse’ doesn’t have the class identifier “dot”…
So your current code is:
$("christmaswarehouse a.avia-slide-wrap")
but it should be like this:
$(".christmaswarehouse a.avia-slide-wrap")
Please give this a try and then clear your browser cache, and check.Best regards,
MikeNovember 26, 2020 at 5:20 am #1263175Thank you for pointing that out.
My ‘screaming frog’ analysis still says the links are dofollow. But, when I inspect the image on the page it seems to be nofollow. What is the best way to know for sure if it has worked?
November 26, 2020 at 2:05 pm #1263260Hi,
I’m not sure what ‘screaming frog’ is, but this script works in the DOM, the actual HTML doesn’t contain the change, so is your analysis after the DOM or before?
When I check it is working, please see the screenshot in Private Content area.Best regards,
MikeDecember 3, 2020 at 6:56 am #1264684Okay great. I think I have to trust you that it is working now. Thanks for your help.
December 3, 2020 at 7:05 am #1264686Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Nofollow links on full width easy slider’ is closed to new replies.