Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add social share icons to the top of articles #9

Open
MirandaEcho opened this issue Mar 26, 2020 · 8 comments
Open

Add social share icons to the top of articles #9

MirandaEcho opened this issue Mar 26, 2020 · 8 comments
Assignees
Labels
Priority: Low question Further information is requested
Milestone

Comments

@MirandaEcho
Copy link

No description provided.

@MirandaEcho MirandaEcho added this to the GEOR-002 milestone Mar 26, 2020
@benlk benlk self-assigned this Apr 2, 2020
@benlk
Copy link
Contributor

benlk commented Apr 2, 2020

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
Copy link
Contributor

benlk commented Apr 3, 2020

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:

<?php global $post; ?>
<div class="post-image-sharrre">
<?php
$thumb = plsh_get_thumbnail('gallery-large', true, false);
if(!$thumb)
{
$thumb = '';
}
?>
<div class="shareme" data-image="<?php echo esc_url($thumb); ?>" data-url="<?php the_permalink(); ?>" data-text="<?php the_title(); ?>"></div>
</div>

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

jQuery('.shareme').sharrre({
share: {
twitter: true,
facebook: true,
googlePlus: true,
pinterest: true,
linkedin: true
},
template: '<div class="box"><div class="left"><strong>{total}</strong> shares</div><div class="right"><a href="#" class="sharrre-facebook"><i class="fa fa-facebook-square"></i></a><a href="#" class="sharrre-twitter"><i class="fa fa-twitter-square"></i></a><a href="#" class="sharrre-googleplus"><i class="fa fa-google-plus-square"></i></a><a href="#" class="sharrre-pinterest"><i class="fa fa-pinterest-square"></i></a><a href="#" class="sharrre-linkedin"><i class="fa fa-linkedin-square"></i></a></div></div>',
enableHover: false,
enableTracking: true,
urlCurl: ajax_object.ajaxurl + '?action=sharrre',
buttons: { pinterest: { media: jQuery('.shareme').data('image'), description: jQuery('.shareme').data('text') } },
render: function(api, options){
jQuery(api.element).on('click', '.sharrre-twitter', function() {
api.openPopup('twitter');
});
jQuery(api.element).on('click', '.sharrre-facebook', function() {
api.openPopup('facebook');
});
jQuery(api.element).on('click', '.sharrre-googleplus', function() {
api.openPopup('googlePlus');
});
jQuery(api.element).on('click', '.sharrre-pinterest', function() {
api.openPopup('pinterest');
});
jQuery(api.element).on('click', '.sharrre-linkedin', function() {
api.openPopup('linkedin');
});
}
});

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
Copy link
Contributor

benlk commented Apr 3, 2020

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
Copy link
Contributor

benlk commented Apr 3, 2020

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
Copy link
Contributor

benlk commented Apr 3, 2020

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

@MirandaEcho
Copy link
Author

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
Copy link
Contributor

benlk commented Apr 6, 2020

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 benlk added the question Further information is requested label Apr 9, 2020
@benlk
Copy link
Contributor

benlk commented May 4, 2020

Yes, scrap the social share counters.

@benlk benlk mentioned this issue May 5, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants