Support » Plugin: Scriptless Social Sharing » Change button class

  • Resolved jfkseo


    Hi Robin,

    How can I change the button class -and so it won’t be overwritten with a next update?

    P.S; love the simplicity of the plugin.

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


    Hi Fred! You can do this by using the plugin’s link markup filter. Here’s an example:

    add_filter( 'scriptlesssocialsharing_link_markup', 'prefix_modify_scriptless_button', 10, 2 );
     * Modify the link output for Scriptless Social Sharing buttons.
     * @param $output
     * @param $button
     * @return string
    function prefix_modify_scriptless_button( $output, $button ) {
    	$target = 'email' === $button['name'] ? '' : ' target="_blank"';
    	return sprintf( '<a class="button %s %s"%s href="%s" rel="noopener" %s><span class="sss-name">%s</span></a>',
    		esc_attr( $button['name'] ),
    		esc_attr( 'my-custom-class' ), // this is where you would put your custom class.
    		esc_url( $button['url'] ),

    Basically this is an exact copy of the plugin’s original button markup function, but with an extra line/class added in ('my-custom-class'). Hope this helps you get started.

    Hi Robin,
    Thank you very much for your help !

    • This reply was modified 1 year, 3 months ago by jfkseo.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change button class’ is closed to new replies.