-
AuthorPosts
-
April 21, 2023 at 10:23 pm #1405208
Hi team,
I am currently creating a website for a sports club with a partner/logo element on the front page. They are thinking about increasing their annual fee if the links on the site should be “follow” instead of “nofollow”. I.e. it may be that some links should be “follow” and some “nofollow” in the same partner/logo element. How can I set each logo to follow or nofollow individually?
Thx in advance!
MarkusApril 22, 2023 at 4:30 pm #1405236Hey mrqslmk,
Thanks for your question, I assume that you are not using any plugins like Yoast to set the nofollow on your links, in my test site the Partner/Logo Element doesn’t have the “rel” attribute set so I recommend this code to the end of your child theme functions.php file in Appearance ▸ Editor:function custom_script() { ?> <script> (function($){ $('.avia-logo-grid .slide-entry').each(function() { $(this).find('a[href *="google.com"]').attr("rel", "nofollow"); $(this).find('a[href *="kriesi.at"]').attr("rel", "follow"); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
and adjust the links to suit and add as many as you like. This sets the nofollow or follow based on the link URL
Best regards,
MikeApril 22, 2023 at 5:47 pm #1405238Hey Mike,
thx for your response. I’m afraid this didn’t work on my end.
I added the script you provided to the functions.php of my child theme, replaced your links with mine and then checked in the dev tools of the frontend if I can see a rel=”nofollow” or “follow”. In both cases, I only see “noopener noreferrer”.
April 22, 2023 at 7:26 pm #1405246Hi,
It sounds like you have a plugin adding noopener noreferrer try disabling your plugins and checking again.
Otherwise please include an admin login in the Private Content area and link to the page so we can be of more assistance.Best regards,
MikeApril 22, 2023 at 9:14 pm #1405253Hi Mike,
I’ve just deactivated all plugins, same issue. Please check credentials in the private content.Afterwards, I reactivated them. Please feel free to deactivate the plugins again while making your tests. I’d just like to ask you to reactivate them again afterwards.
Thank you!
- This reply was modified 1 year, 7 months ago by mrqslmk.
April 22, 2023 at 9:54 pm #1405256Hi,
Thanks for the login, I found that setting the links to open in a new tab adds this, so I adjusted the script to have a slight delay and this seems to have corrected. Please clear your browser cache and check.function custom_script() { ?> <script> (function($){ setTimeout(function () { $('.avia-logo-slider .slide-entry').each(function() { $(this).find('a[href *="link-one.de"]').attr("rel", "nofollow"); $(this).find('a[href *="link-two.de"]').attr("rel", "follow"); $(this).find('a[href *="link-three.de"]').attr("rel", "follow"); }); }, 300); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
Best regards,
MikeApril 22, 2023 at 9:59 pm #1405258That works perfectly. Thank you so much!
April 22, 2023 at 10:20 pm #1405260Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘Partner/Logo Element: No follow vs. follow links’ is closed to new replies.