Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1247644

    Hello

    I want to remove the rel = “nofollow noopener noreferrer” and I don’t remember how I did it, I have checked the functions.php and the Quick CSS but I can’t find the place where I put that code

    In this url: https://www.dinosaurios.tienda/dinosaurios-de-juguete/
    is this button:

    If it is not in the funtions.php (or child) where is it?

    Thanks!!!!

    • This topic was modified 4 years, 2 months ago by Astrobiologic.
    #1248723

    Hey Ganubis,
    Sorry for the late reply, woocommerce adds the “nofollow” to the cart button, to remove try adding this code to the end of your functions.php file in Appearance > Editor:

    add_filter( 'woocommerce_loop_add_to_cart_args', 'remove_rel', 10, 2 );
    function remove_rel( $args, $product ) {
        unset( $args['attributes']['rel'] );
    
        return $args;
    }

    I tested this on my localhost and it works, after you add the code please clear your cache and check.

    Best regards,
    Mike

    #1248729

    Hi Mike,

    What I want is to remove the “noopener noreferrer” I have looked for it everywhere but I cannot find it. It’s not in functions.php and I can’t find where that is written. or how to remove it.

    Thank you very much. and a gretting

    #1248738

    Hi,
    On my install I do not have the “noopener noreferrer”, but the function above removes the attribute which should be all three for you
    “nofollow noopener noreferrer” unless the “noopener noreferrer” is being loaded after the DOM, which would indicate that this is being added by a plugin.
    Please give it a try.

    Best regards,
    Mike

    #1248807

    Hi Mike, I did try the code you gave me first.

    I have tried it, I have placed it in the functions.php of the child theme but it has no effect. So do you have any idea how or where I can find where that is written?

    I want to leave it as it was originally (nofollow) only

    Thank you very much for your help. Receives a warm greeting

    #1248835

    Hi,
    Thanks for the feedback and the login, I tried to investigate your shop page, but you don’t have woocommerce installed on your site, is this just temporary?
    I also investigated your child theme functions.php and wanted to disable this function:

    add_action('wp_footer', 'ava_add_rel_nofollow');
    function ava_add_rel_nofollow(){
    	?>
    	<script type="text/javascript">
    		(function($) {
    			$('.single_add_to_cart_button').attr('rel', 'nofollow sponsored');
    		})(jQuery);
    	</script>
    	<?php
    }

    but WordPress gave the error Uncaught Error: Call to undefined function is_shop() in wp-content/themes/enfold-child/functions.php:24 for this code in your child theme functions.php:

    function woocommerce_disable_shop_page() {
        global $post;
        if (is_shop()):
        global $wp_query;
        $wp_query->set_404();
        status_header(404);
        endif;
    }
    add_action( 'wp', 'woocommerce_disable_shop_page' );

    so I had to disable this also, this will have to be re-written if you plan on using it in the future.
    Please let us know when woocommerce is installed again so we can investigate further, but I believe your “noopener noreferrer” can be removed with this solution, please give it a try and let us know.

    Best regards,
    Mike

    #1248841

    Hi mike, sorry I was just replacing the folders.

    I was completely deleting the WooCommerce and Woozone plugin folders, replacing them with a fresh copy.

    I have removed the lines of code from the child theme functions.php as you have recommended. but it remains the same.

    I want to leave it as it was originally (nofollow) only. but i dont know how.

    Now if you can get in, the folders have already been replaced. excuse me one more time

    Thanks Again

    #1248875

    Hi,
    Thanks for the feedback, to leave “nofollow” and remove “noopener noreferrer” from the cart buttons I added this function to your child theme functions.php:

    //This code removes noreferrer & noopener from your woocommerce cart buttons
     function remove_noreferrer_noopener_from_woo_cart_buttons($rel_values) {
     return 'nofollow';
     }
     add_filter('wp_targeted_link_rel', 'remove_noreferrer_noopener_from_woo_cart_buttons',999);

    This is working now, please clear your browser cache and check.

    Best regards,
    Mike

    #1248880

    Yeah! It works and allows me to continue. I really appreciate your help. It works perfect.

    Finally I have modified your code a bit:
    return 'nofollow sponsored';

    Because I want to try the new “sponsored” rel for these types of links. Google says that for an affiliate link the most natural rel is “sponsored”.

    Once again, Thanks for your help :)

    • This reply was modified 4 years, 2 months ago by Astrobiologic.
    #1248894

    Hi,
    Glad we were able to help, we will close this now. Thank you for using Enfold.

    For your information, you can take a look at Enfold documentation here
    For any other questions or issues, feel free to start new threads in the Enfold forum and we will gladly try to help you :)

    Best regards,
    Mike

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Help to find the code of rel = "nofollow noopener noreferrer" in products page.’ is closed to new replies.