jaredatch / Shared-Counts

WordPress plugin that leverages SharedCount.com API to quickly retrieve, cache, and display various social sharing counts.
GNU General Public License v2.0
48 stars 16 forks source link

Pinterest URL params missing with pinit.js #95

Open jaredatch opened 4 years ago

jaredatch commented 4 years ago

In #34 we restored the Pinterest button if pinit.js is running.

However all the URL params present in the original URL (description and media) are not available.

For the Pinterest button, we would probably need to add data-description and data-media, then read that from the JS and add the the URL we use to fix the button.

billerickson commented 4 years ago

I think it would be safer to add a data-href attribute with the full URL and restore from that.

Right now the only way to customize the description is to rebuild the URL. That's how the Shared Counts - Pinterest Image plugin does it (see code).

If we do store the description and media separately, we'll need to add a filter for customizing the description and update the Pinterest Image addon plugin to use it.

jaredatch commented 4 years ago

As suggested by @billerickson

Hook late into shared_counts_link(99 priority or something) and add something like$link['data']['href'] = $link['link']` or whatever it is we use for data attributes.

Then update the JS and attempt to restore URL from data attribute.