Support » Plugin: Genesis Simple Share » Pinterest – Changing the image + description pulled

  • Hello!

    I have just installed the Genesis Simple Share plugin.

    I would like to have it so that when someone clicks on the Pinterest share button, the plugin pulls the first image in the post (rather than the featured image) and uses the data-pin-description attribute (rather than the post title) to populate the Pinterest description field.

    Is there some way I can do this? I’m comfortable editing the plugin’s files but I’m just not sure how to do this.

    Any help would be greatly appreciated!

    Temperance.

Viewing 1 replies (of 1 total)
  • Plugin Support Nick Cernis

    (@modernnerd)

    Hi, @temperancerose.

    Thanks for using Genesis Simple Share!

    You’d need to edit the get_icon_output function in plugins/genesis-simple-share/lib/front-end.php to make the modifications you describe.

    That function sets the image URL and description used for each button:

    $image = ( $image = genesis_get_image( array( 'format' => 'url', 'size' => 'full' ) ) ) ? $image : $this->get_first_image();

    $description = the_title_attribute( array( 'echo' => false ) );

    You could modify those with an if statement to set the imgae to be the first image and the description to be the data-pin-description attribute for the Pinterest button. For example, for the image:

    if ( 'pinterest' === $icon ) {
    	$image = $this->get_first_image();
    } else {
    	$image = ( $image = genesis_get_image( array( 'format' => 'url', 'size' => 'full' ) ) ) ? $image : $this->get_first_image();
    }
    

    If you’d like further help with this or other plugin and theme customisations, I recommend making use of the StudioPress community resources here: https://my.studiopress.com/community/

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.