Tagged: nofollow
-
AuthorPosts
-
June 16, 2016 at 4:03 pm #649293
So that I can comply with Google’s heavy-handed guidelines, I need to be able to selectively add the rel=”nofollow” attribute to all my Promo Boxes and Buttons.
Below, I’ve included links to example pages where I use the Promo Box and Buttons quite judiciously. They all need a rel=”nofollow” link added:
Promo Boxes: http://www.guitaranswerguy.com/11-jamplay-walkthrough/
Buttons: http://www.guitaranswerguy.com/guitar-resources/I’m comfortable writing and modifying a little code, if necessary.
Thanks!
p.s. – I tried this solution: https://kriesi.at/support/topic/add-relnofollow-on-button-links/ but it puts the “nofollow” on the outer <div> tag, whereas I need it within the actual HREF tag.
- This topic was modified 8 years, 4 months ago by Guitar Answer Guy.
June 20, 2016 at 3:54 am #650559Hey Bobby,
Thank you for using Enfold.
Please replace the custom script with the following:
// custom script add_action('wp_footer', 'ava_custom_script'); function ava_custom_script(){ ?> <script> (function($) { function a() { $('.av_promobox').each(function() { $(this).find('.avia-button-wrap a').attr('rel', 'nofollow'); }); } a(); })(jQuery); </script> <?php }
Best regards,
IsmaelJune 20, 2016 at 10:47 pm #651129Unfortunately, this isn’t doing what I need (unless I implemented it incorrectly). It simply adds another CSS class called “nofollow” or “rel-nofollow” within the DIV element that is around the HREF. You can see this here:
http://www.guitaranswerguy.com/guitar-resources/
I applied your suggestion to the very 1st button on the page (“Buy it on Amazon.com” button under “Humitar Acoustic Guitar Humidifier”). If you view the source code, you’ll see what I mean. It’s simply adding another CSS class to the DIV, not adding rel=”nofollow” to my anchor link:
Instead, what I need is something like this:
<a href="http://someurl.com" rel="nofollow" target="_blank">Buy it on Amazon.com</a>
Note that the rel=”nofollow” is inside the A tag itself.
June 22, 2016 at 3:11 pm #652136Hi,
Please add following code to Functions.php file of your child theme in Appearance > Editor
function custom_class_rel(){ ?> <script> jQuery(window).load(function(){ jQuery('.rel-nofollow a').attr('rel','nofollow'); }); </script> <?php } add_action('wp_footer', 'custom_class_rel');
Best regards,
Yigit- This reply was modified 8 years, 4 months ago by Yigit.
June 22, 2016 at 5:27 pm #652272I’ll give it a try. Should this code REPLACE the code I added before? Or, this this be added IN ADDITION to the previous code?
Thanks,
Bobby
June 24, 2016 at 6:26 pm #653131 -
AuthorPosts
- You must be logged in to reply to this topic.