Support » Plugin: Scriptless Social Sharing » How to disable SSS in mobile version

  • Resolved Suanlian Tangpua

    (@suanlian)


    Hi,

    Is there a way to disable the SSS plugin in mobile version. I tried the CSS trick display: none; it works but I think that’s not a proper way.

    Kind Regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Robin Cornett

    (@littlerchicken)

    There is a filter for the plugin which determines whether or not the buttons can be output. You can combine that with the WordPress function wp_is_mobile to prevent the buttons showing on mobile devices. Something like this is working in brief testing for me:

    
    add_filter( 'scriptlesssocialsharing_can_do_buttons', 'prefix_scriptless_remove_on_mobile' );
    /**
     * Use the built in wp_is_mobile function and do not output buttons on mobile.
     *
     * @param boolean $cando
     * @return boolean
     */
    function prefix_scriptless_remove_on_mobile( $cando ) {
    	if ( wp_is_mobile() ) {
    		return false;
    	}
    
    	return $cando;
    }
    

    You would need to add this to your theme’s functions.php file or a place where you can safely store code snippets. Practice safe coding and please make sure your files are backed up.

    Thread Starter Suanlian Tangpua

    (@suanlian)

    Thank you so very much Robin! It works perfectly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to disable SSS in mobile version’ is closed to new replies.