• Resolved dajanas

    (@dajanas)


    Hi,

    How can I remove the script in Easy Fancybox where the social shares are loaded?

    Right now, on every page where Easy Fancybox is used, the source code loads code for shares like pinterest.com/pin/create, facebook.com/share and twitter.com/share. For privacy reasons, I would like to remove these codes completely. I don’t use shares in the fancybox anyway.

    Where can I find the setting to remove this completely? Or how do I achieve this via functions.php?

    Greetings

Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi @dajanas, the Easy Fancybox plugin does not load any social share scripts. If you are seeing social sharing buttons, they must be coming from another plugin or your theme.

    If you can share a link to your site, I can take a quick look for you…

    Thread Starter dajanas

    (@dajanas)

    Hi, this is not true. Contrary to your statement, I find the following lines of code in the plugin folder of easy-fancybox in the folder “inc” in the class-easyfancybox.php file, which can also be found on every page in the source code of my site, where the EasyFancybox is used. You claim there are no “social share scripts” or “sharing buttons”, but the code contradicts you there:

    This is in the file class-easyfancybox.php:

    $script .= ' };
    if(typeof easy_fancybox_handler===\'undefined\'){
    var easy_fancybox_handler=function(){
    jQuery(\'.nofancybox,a.wp-block-file__button,a.pin-it-button,a[href*="pinterest.com/pin/create"],a[href*="facebook.com/share"],a[href*="twitter.com/share"]\').addClass(\'nolightbox\');';
    
    		foreach (self::$options as $key => $value) {
    			// check if not enabled or hide=true then skip
    			if ( isset($value['hide']) || !get_option(self::$options['Global']['options']['Enable']['options'][$key]['id'], self::$options['Global']['options']['Enable']['options'][$key]['default']) )
    				continue;

    And here’s how it looks on the public website:

    <script type='text/javascript' id='jquery-fancybox-js-after'>
    var fb_timeout, fb_opts={'overlayShow':true,'hideOnOverlayClick':true,'overlayOpacity':0.6,'overlayColor':'#000','showCloseButton':true,'margin':20,'centerOnScroll':true,'enableEscapeButton':true,'autoScale':true };
    if(typeof easy_fancybox_handler==='undefined'){
    var easy_fancybox_handler=function(){
    jQuery('.nofancybox,a.wp-block-file__button,a.pin-it-button,a[href*="pinterest.com/pin/create"],a[href*="facebook.com/share"],a[href*="twitter.com/share"]').addClass('nolightbox');
    /* IMG */
    var fb_IMG_select='a[href*=".webp"]:not(.nolightbox,li.nolightbox>a),area[href*=".webp"]:not(.nolightbox),a[href*=".jpg"]:not(.nolightbox,li.nolightbox>a),area[href*=".jpg"]:not(.nolightbox),a[href*=".png"]:not(.nolightbox,li.nolightbox>a),area[href*=".png"]:not(.nolightbox)';
    jQuery(fb_IMG_select).addClass('fancybox image').attr('rel','gallery');
    jQuery('a.fancybox,area.fancybox,li.fancybox a').each(function(){jQuery(this).fancybox(jQuery.extend({},fb_opts,{'transitionIn':'elastic','easingIn':'easeOutBack','transitionOut':'elastic','easingOut':'easeInBack','opacity':false,'hideOnContentClick':false,'titleShow':true,'titlePosition':'inside','titleFromAlt':true,'showNavArrows':true,'enableKeyboardNav':true,'cyclic':false}))});};
    jQuery('a.fancybox-close').on('click',function(e){e.preventDefault();jQuery.fancybox.close()});
    };
    jQuery(easy_fancybox_handler);jQuery(document).on('post-load',easy_fancybox_handler);
    </script>

    I don’t want these buttons/share tools or generally all the code components with twitter.com/share, “facebook.com/share” and “pinterest.com/pin/create” etc. in the code. Hence my question, how to remove them completely so that none of them show up anywhere in the code anymore?

    Thread Starter dajanas

    (@dajanas)

    Hello?

    Hello?

    Hi ??

    The line

    jQuery('.nofancybox,a.wp-block-file__button,a.pin-it-button,a[href*="pinterest.com/pin/create"],a[href*="facebook.com/share"],a[href*="twitter.com/share"]').addClass('nolightbox');
    

    is there to make sure that the light box does NOT bind itself to possible conflicting elements like share buttons. IT does not create any share buttons itself.

    Thread Starter dajanas

    (@dajanas)

    Okay, then I know about it. Thanks! ??

    Thread Starter dajanas

    (@dajanas)

    Is it possible to remove these entries somehow (e.g. via functions.php) completely? Because my paid cookie plugin warns all the time that any share buttons are integrated here. Is not the case according to your statement, but it warns all the time. I would like to have this line removed.

    Okay, I see… that is annoying indeed.

    The only way to remove that line is to edit the file class-easyfancybox.php

    In your WordPress admin plugin file editor, modify these two lines

    
    var easy_fancybox_handler=function(){
    jQuery(\'.nofancybox,a.wp-block-file__button,a.pin-it-button,a[href*="pinterest.com/pin/create"],a[href*="facebook.com/share"],a[href*="twitter.com/share"]\').addClass(\'nolightbox\');';
    

    and make it one line:

    
    var easy_fancybox_handler=function(){';
    

    (notice that the end of the second line '; is at the end if the first line now!)

    And I’ll consider making these “share button exceptions” optional for the next release ??

    Thread Starter dajanas

    (@dajanas)

    I was about to say that the change in the file would be reversed by a new update. Glad you’re integrating that into the next update! ?? Thank you very much, that makes me happy!

    Thread Starter dajanas

    (@dajanas)

    Question: Version 1.8.19 was released today. Should the version already include the option regarding shares? After the update twitter.com/share etc. is in the code again.

    Thread Starter dajanas

    (@dajanas)

    Ah, I found it. It is now a text input field. Okay. Thanks!

    Sorry, yes I meant to tell you about it before the release but forgot… Good to know you found it ??

    You can remove all the value there or only the ones (twitter/facebook/pinterest) that cause the conflict.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Remove Social Shares’ is closed to new replies.