Support » Plugin: Scriptless Social Sharing » Add support for browser extensions

  • PNW Web Works

    (@pnwwebworks)


    Is it possible to add support for browser extensions such as the Pinterest button and Tailwind for the hidden Pinterest image and description? The hidden image and description does not currently show up when using the Pinterest browser extension on Firefox, and Tailwind shows the image, but no description.

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

    (@littlerchicken)

    Since the extensions rely on JavaScript for their functionality, there isn’t a lot I can do. Looking at the information for Pinterest, I can try adding a data-pin-do attribute to the hidden image and see if that helps, or you could try it without waiting for me by adding it to the image attributes using the scriptlesssocialsharing_pinterest_image_attributes filter, if you are comfortable adding a filter to your site.

    Thread Starter PNW Web Works

    (@pnwwebworks)

    Here is what I came up with that works to add to the Tailwind and Pinterest buttons both the image and description. I am sure there is a cleaner way from within the plugin. I used code from some of your other functions to create the filter.

    //Social Image Filter
    function sss_pnw_pinterest_attributes( ) {
    $pinterest_id = get_post_meta( get_the_ID(), ‘_scriptlesssocialsharing_pinterest’, true );
    return array(
    ‘data-pin-media’ => pnw_pinterest_url($pinterest_id),
    ‘style’ => ‘display:none;’,
    ‘alt’ => $alt_text ? $alt_text : the_title_attribute( ‘echo=0’ ),
    ‘data-pin-description’ => pnw_pinterest_description($pinterest_id),
    ‘class’ => ‘scriptless__pinterest-image’,
    );
    }
    function sss_pnw_pinterest_description ($id) {
    $pinterest_alt = get_post_meta( get_the_ID(), ‘_scriptlesssocialsharing_description’, true );
    if ( $pinterest_alt ) {
    return $pinterest_alt;
    }
    $pinterest_alt = get_post_meta( $id, ‘_wp_attachment_image_alt’, true );
    return $pinterest_alt ? $pinterest_alt : $this->attributes[‘title’];
    }
    function sss_pnw_pinterest_url($id ) {
    $source = wp_get_attachment_image_src( $id , ‘large’, false );
    return apply_filters( ‘scriptlesssocialsharing_image_url’, isset( $source[0] ) ? $source[0] : ” );

    }

    add_filter( ‘scriptlesssocialsharing_pinterest_image_attributes’, ‘sss_pnw_pinterest_attributes’);`

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add support for browser extensions’ is closed to new replies.