Closed nickcernis closed 9 years ago
The share on pinterest button is effectively sharing the post and using the featured image. There isn't really alt text to pull from in the featured image. The script isn't scanning the page to find an image and share that. There are other plugins for pinning images which would be more appropriate to that usage.
There isn't really alt text to pull from in the featured image.
I think something like this might work:
$thumb_id = get_post_thumbnail_id( $post->ID );
$alt_text = get_post_meta( $thumb_id, '_wp_attachment_image_alt', true );
If no alt text is set for the image, $alt_text
will be empty.
I agree with you that reproducing the entire functionality of the official Pinterest button to scan the page for images with JS might be overkill. I just wanted to report that customers find the existing GSS Pinterest share behaviour frustrating, because they're used to other Pinterest share buttons pulling in the alt text instead of the title. Right now, they have no way to set a custom description other than editing the post title.
Other (non-official) implementations of share buttons automate the use of alt text by linking to pin/find/
instead of pin/create/
, which seems to give a sharing experience that's closer to the native Pinterest one.
e.g. Try clicking the Pinterest badge in this article:
Is that worth considering as a workaround?
The official Pinterest “Pin It” button (Chrome) pulls the Pinterest description from image alt text:
Genesis Simple Share currently uses the post title for the Pinterest description instead:
The post I'm testing this with is at http://nick-cernis.preview76.rmkr.net/post-category-13/.
User expectation is that the Pinterest description should come from image alt text if it's set, rather than from the post title.
Using alt text for the title is also recommended in this post from the Copyblogger blog:
Perhaps Simple Share should also use alt text when available when sharing via Pinterest, just as the official Pinterest button does, then fall back on the post title if no alt text is available?