Tagged: 

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #649230

    Hi,

    I have an affiliate review site: http://testogbedst.dk/bedste-loebesko-damer-2016/

    I have manually added rel=”nofollow” to a link. Isn´t there a way to add it automatically?

    Regards Peter

    #649232

    Hey Petersjuul,

    Please enable the custom css class field: http://kriesi.at/documentation/enfold/turn-on-custom-css-field-for-all-alb-elements/ and then edit your element and give it a custom class and then add following code to functions.php file in Appearance > Editor

    function add_nofollow_attr(){
    ?>
     <script>
    jQuery(window).load(function(){
    jQuery('.your-custom-class a').attr('rel','nofollow');
    });
     </script>
    <?php
    }
    add_action('wp_footer', 'add_nofollow_attr');

    Best regards,
    Yigit

    #649924

    I have this same need, and when I implemented Yigit’s solution, it added rel=”nofollow” to the outer <div>… not the HREF tag, as needed.

    How can we add “nofollow” to the HREF tag itself?

    #650001

    Hey!

    can you please create a new ticket ticket and provide us a link of your web site, so we can give it a look?
    Thank you

    Best regards,
    Basilis

    #650060
    #651037
    #655917

    Hi Yigit,

    It works perfect – And also on my MTB blog :-)

    But when I add other links than affiliate links, I would like that they are followed(do follow)

    Is there a way to accomplish this or should I make new elements for these?

    Regards Peter

    #656575

    Hi,

    They will be followed unless you add nofollow attribute :)

    Best regards,
    Yigit

    #997621

    Hi Enfold helpers,

    If we want to let all links in footers and body to get nofollow, How can we change this line?
    jQuery(‘.your-custom-class a’).attr(‘rel’,’nofollow’);

    I am very bad in code and really need your help on exact code.

    Thanks,
    Hoang

    #997689

    Hi,

    You can use

    jQuery(‘body’).attr(‘rel’,’nofollow’);

    And it should fix the issues for you with no problem

    Best regards,
    Basilis

    #998040

    Thanks Basilis,
    I have added the code with the process of the custom css class field, but the body and footer links still do not turn into nofollow. I also need to add the nofollow for button and the total code is like this

    function add_nofollow_attr(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery(‘body’).attr(‘rel’,’nofollow’);
    });
    </script>
    <?php
    }
    add_action(‘wp_footer’, ‘add_nofollow_attr’);
    // 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
    }

    Is that bad?

    The second part is just a copy from here

    My web is https://mekongtrails.com
    Thanks,
    Hoang

    • This reply was modified 6 years, 3 months ago by Hoang Truong.
    #998425

    Hi,

    The code won’t work if you add it to the quick css field because it’s no css code. Add this code to the child theme functions.php instead (Appearance > Editor > Enfold (or Enfold child) and select “functions.php”):

    
    
    function avia_custom_head_javascript() {
        ?>
            <script>
      	jQuery(document).ready(function() {
      	  jQuery('body > a').attr('rel','nofollow');
      	});	
            </script>
        <?php
    }
    add_action('wp_footer', 'avia_custom_head_javascript');
    

    Best regards,
    Dude

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.