Viewing 23 posts - 1 through 23 (of 23 total)
  • Author
    Posts
  • #903651

    Hello

    I was using Google Chrome’s Lighthouse (https://developers.google.com/web/tools/lighthouse/#devtools) to run an audit of my WordPress site (using your excellent Enfold theme)

    It showed up that the social media links generated by social profiles in Enfold do not add rel="noopener"

    https://developers.google.com/web/tools/lighthouse/audits/noopener

    It showed a few different issues to be fair, it might be worth you guys running it and seeing what you can fix.

    Thanks

    Andy

    #904634

    Hey kaylanx,

    Thank you for using Enfold.

    You can use the following script in the functions.php file to apply a rel attribute to the social media icons.

    add_action('wp_footer', 'ava_custom_script');
    function ava_custom_script(){
    	?>
    	<script type="text/javascript">
    	(function($) {
    		function a() {
    			$('#top #wrap_all .social_bookmarks li a').each(function(){
    			  $(this).attr('rel', 'noopener');
    			});
    		}
    		
    		a();
    	})(jQuery);
    	</script>
    	<?php
    }

    Best regards,
    Ismael

    #971300

    Hi,

    thanks for the answer. I had the same question.

    Unfortunately the test reports same issue again, so the script won´t work maybe. May social buttons are next to main menu. I i remove them, the message disappears.

    Regards

    • This reply was modified 6 years, 5 months ago by Pako.
    #971556

    Hi,

    Did you purge the cache after adding the script? Please provide a link to a page with the social media links.

    Best regards,
    Ismael

    #971724

    Hi, yes cache was cleaned before. Adress is Werk32.NET The icon is located in the upper right corner (Youtube Symbol).

    • This reply was modified 6 years, 5 months ago by Pako.
    #972019

    Hi,

    My fault. I didn’t notice that the filter was commented out. It was actually disabled. Please try the code again.

    Best regards,
    Ismael

    #972217

    Hi same behavior. :(

    #972595

    Hi,

    Thanks for the update.

    We would like to test the script. Please provide the WP login details. Make sure that the Appearance > Editor panel is accessible.

    Best regards,
    Ismael

    #974844
    This reply has been marked as private.
    #975086

    Hi,

    Thanks for the update.

    The “wp-admin” and “wp-login” path leads to a 404 page. I also tried “login”. What is the actual login url?

    Best regards,
    Ismael

    #975115
    This reply has been marked as private.
    #975123

    Hi,

    Thanks for the update.

    We implemented the code and confirmed that the social icons have the rel attribute set to “noopener”.

    Best regards,
    Ismael

    #975139

    Awesome! Will it stay after an update?

    #975241

    Hi Werk32,

    If the code is in the child theme functions.php it will, otherwise it will be lost.

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #975245

    Hi. Are you able to move the code to the child theme. I am unsure that i take the right part of the code.

    #975474

    Hi Werk32,

    Image 2018-06-20 at 22.04.27.png
    This function needs to be moved to the child theme.

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #975508

    I got around this by using the Real Time Find and Replace plugin:

    https://wordpress.org/support/plugin/real-time-find-and-replace

    I added the find as target='_blank' and the replace as target='_blank' rel='noopener'

    However, the reason I initially raised this issue wasn’t for a work around like mine or like the code change you have suggested. It was to point out that there is an issue with Enfold that needs to be fixed in a release of the the theme, not patched by the end users of your theme.

    Thanks

    Andy.

    #975613

    Hi,

    Thanks for the info. We’ll forward this to the team. :)

    Best regards,
    Ismael

    #975614

    Hi,

    Thanks for the info. I’ll forward this to the team. :)

    Best regards,
    Ismael

    #1013258

    Hello,
    I also would like to add a function for the “Advertising Area” widget links – how would I have to modify the function?

    <a target="_blank" href="https://www.domain.com/" class="preloading_background avia_partner2 link_list_item1 ">...</a>

    Best regards,
    Neverlands

    #1013260

    Hi,

    Please add this code to your child theme functions.php – it will add the noopener attribute to all partner widget links:

    
    function avia_add_noopener_to_links(){
    ?>
    <script type="text/javascript">
    (function($) {
    $('.avia_partner1, .avia_partner2').each(function(){
    	var a = $(this);
    	var originalRel = (this.rel === undefined) ? '' : this.rel.toLowerCase();
    	var newRel = originalRel.split(" ");
    	if (originalRel.indexOf('noopener') === -1) newRel.push('noopener');
    	a.attr('rel', newRel.join(" ").trim());
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'avia_add_noopener_to_links');
    

    Best regards,
    Peter

    #1013375

    Hi Peter,

    it works – many thanks!

    Best regards,
    Neverlands

    #1013383

    Hi!
    Great, glad I could help you :)

    Regards,
    Peter

Viewing 23 posts - 1 through 23 (of 23 total)
  • The topic ‘Social Media links don't have rel="noopener"’ is closed to new replies.