Closed dreadedhamish closed 7 years ago
Just to confirm, the current setting (using the "title" as the description) is the expected behavior in most situations. If you add some code to your site enabling Rich Pins, you would also like the description changed to the "excerpt".
I don't believe a change is required to EA Share Count for this. You can accomplish this with the existing filters. Something like this should work (untested):
/**
* Use Excerpt for Pinterest Description
*
*/
function ea_use_excerpt_for_pinterest_description( $link ) {
global $post;
if( 'pinterest' == $link['type'] ) {
$link['link'] = str_replace( '&description=' . $link['title'], '&description=' . $post->post_excerpt, $link['link'] );
}
return $link;
}
add_filter( 'ea_share_count_link', 'ea_use_excerpt_for_pinterest_description' );
You are awesome!
Thanks.
This concerns Rich Pins - at least of the type 'Article', I haven't tested on other pin types.
On a regular pin passing the title works best as the description for a pin, but for a Rich Pin Pinterest will scrape the page for the title, and use the description passed in the link for the description. This leads to the pin having the title twice on the board view (bold title for title, normal weight title for description).
I'd suggest passing the excerpt instead for Rich Pins.
There is no way of telling from the page content whether it's got Rich Pinning enabled, and they may be enabled on some post types and not others, or even some categories and not others.
Maybe a hook for use excerpt instead of title for description, and users can then wrap that in a conditional to meet their needs. Personally I'd add a conditional to apply it to posts, but others may apply it conditionally for post types or categories.