-
AuthorPosts
-
January 20, 2017 at 2:56 am #736157
Is there a way to ask the user which image on the page they want to share when they click the Pin It button? I want to provide a different image for Pinterest to conform to their portrait orientation guidelines so defaulting to the featured image doesn’t work for me.
Here’s an example page: http://www.lottaveg.com/vegan-baked-potato/.
If you click the Pinterest “Save” button below the recipe description, it opens an image selection layer with both the landscape featured image and the portrait image that’s included in the content. However, when I click the Pin icon in the share bar below the recipe, it defaults to the featured image without giving me the option to select the portrait version.
Ideally, I’d like to be able to use a hidden image for Pinterest as described here: http://pinchofyum.com/how-to-hide-an-image-in-a-wordpress-post.
Thanks!
JPJanuary 25, 2017 at 6:19 am #738123Hi jstonestreet!
Thank you for using Enfold.
This is possible but it will take a major modification in the includes > helper-social-media.php > avia_social_share_links class. The sharing section has a preset pattern and it can be modified, though limited, with the following filter.
add_filter('avia_social_share_link_arguments', 'avia_add_social_share_link_arguments', 10, 1); function avia_add_social_share_link_arguments($args) { $args['pinterest']['pattern'] = "http://pinterest.com/pin/create/button/?url=[permalink]&description=[title]&media=[thumbnail]"; return $args; }
By default, the “media” parameter will take the thumbnail or the featured image as its value. If you really need this feature, please hire a freelance developer or contact our partner, Codeable.
// http://kriesi.at/contact/customization
Regards,
IsmaelJanuary 25, 2017 at 10:35 pm #738633Thanks for the response. I think I’ll leave it as is for now. I added a plugin that puts a Pinterest “save” button on the image I want shared to Pinterest so I think people are more likely to use that anyway.
Everything I’ve read says long portrait images perform up to 70% better on Pinterest than wide landscape images. This would be a nice feature to add in a future release of Enfold.
January 26, 2017 at 10:20 am #738813Hi JP,
Thanks for the feedback, we’ll have a look if that is something we could implement in a future release.
Best regards,
RikardApril 13, 2020 at 12:21 pm #1203270Hello,
I know this is an old thread but it showed up on Google when I searched for the same possibility.
I figured to make it work : display a 2:3 ratio image to Pinterest share pins.First, you need to create a custom size with 2:3 ratio, here I took 600×900 :
add_image_size( 'pinterest-size', 600, 900, true ); add_filter( 'image_size_names_choose', 'custom_pinterest_size' ); function custom_pinterest_size( $sizes ) { return array_merge( $sizes, array( 'pinterest-size' => __( 'Ratio 2:3' ), ) ); }
Then, you can edit the pinterest URL pattern with avia_add_social_share_link_arguments :
add_filter('avia_social_share_link_arguments', 'avia_add_social_share_link_arguments', 10, 1); function avia_add_social_share_link_arguments($args) { if(is_single() && get_the_ID()){ $args['pinterest'] = array("encode"=>true, "encode_urls"=>true, "pattern" => "https://pinterest.com/pin/create/button/?url=[permalink]&description=[title]&media=".get_the_post_thumbnail_url(get_the_ID(), 'pinterest-size'), 'label' => __("Share on Pinterest",'avia_framework')); } return $args; }
And that’s it !
Hope it will help some other who get to this thread from Google with the same issue.April 13, 2020 at 11:52 pm #1203391Hi,
Thank you for sharing the solution!
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Enfold Pinterest Share Image Selection’ is closed to new replies.