INN / umbrella-ghn

Umbrella repository for Georgia Health News
GNU General Public License v2.0
0 stars 1 forks source link

Add social share icons to the top of articles #9

Open MirandaEcho opened 4 years ago

benlk commented 4 years ago

If I'm reading /wp-admin/admin.php?page=goliath-admin right:

Screen Shot 2020-04-02 at 15 53 09

The share buttons should already be enabled.

But they are not showing up.

benlk commented 4 years ago

wp-content/themes/goliath/theme/templates/full-width-image.php:29:

wp-content/themes/goliath/theme/templates/limited-width-image.php:38:

Both post templates load this sharing code on the page at the top:

https://github.com/INN/umbrella-ghn/blob/031c1630a5c902b20153e28e9064bf473b7de20d/wp-content/themes/goliath/theme/templates/share.php#L1-L12

However, it looks like whatever's supposed to be here is loaded dynamically, via the "sharrre" jquery plugin:

https://github.com/INN/umbrella-ghn/blob/031c1630a5c902b20153e28e9064bf473b7de20d/wp-content/themes/goliath/theme/assets/js/theme.js#L920-L950

sharrre comes from the vendored library, https://github.com/INN/umbrella-ghn/blob/master/wp-content/themes/goliath/theme/assets/js/vendor/jquery.sharrre.min.js

That the header in that file notes that it's a beta version of version 1.3.5 of that library, and has been modified.

version 1.3.5 of Sharrre was released in 2013, with a 2.0.1 release in 2016, and no releases thereafter: https://github.com/Julienh/Sharrre/releases

benlk commented 4 years ago

Do we want to try to get the footer social share count buttons to appear at the top of the page instead of fixing the maybe-button that's there now? Screen Shot 2020-04-03 at 12 40 41

benlk commented 4 years ago

These buttons also depend on sharrre, and assume Google Plus and StumbleUpon. The hacked version of sharrre used in this theme tries to query a REST API endpoint registered by the theme as a CORS workaround for Google Plus (rip) and Stumbleupon (?) share counts, but that query doesn't work because the request URL is malformed because in theme.js they're setting the query URL to be ajax_object.ajaxurl + '?action=sharrre', and then sharrre builds its query URLs with string manipulation that doesn't check to see whether there's already a URL parameter specified with ? in the URL.

tl;dr: nooooooooope, don't even want to touch the sharrre stuff; it was dead five years ago and it's still dead now.

Gonna try to patch Largo's code into this, in the child theme.

benlk commented 4 years ago

@MirandaEcho did they tell us what social share buttons they wanted?

MirandaEcho commented 4 years ago

They have Facebook and twitter in the header and footer, so lets start with those for now and we can more in later if they want.

benlk commented 4 years ago

As part of the site-speed improvements, can we remove the JS powering the broken share counters, and the share counters themselves?

Basically: If we remove the share counters, the site can be faster and this ticket gets simpler.

benlk commented 4 years ago

Yes, scrap the social share counters.