Can we please make this plug-in a little more configurable than a simple ‘activate and forget’ plug-in?
Even if you change it so the ‘include in…’ settings are set to No, you still include ALL of your crap, on every page load, on every page.
1 JS, 1 CSS, about 13kb, some random JS fluff and 2 HTTP requests, on every page…no thank you!
I can’t even use the likes of
wp_dequeue_scriptbecause all the JS is lazily hard-coded into the plug-in.
I only need sharing on posts, so all I need is to kill the JS & CSS on !is_singular(‘posts’)…is it that hard?
In order to add sharethis buttons to post pages only, you’ll need to add the buttons manually.
Here are the steps:
Sharethis script and span tags go on the page where you want the buttons to appear and they also determine what kind of button appears as well as what URL and title it shares. You will have to put ‘script tags’ in your Main index template(index.php) and ‘span tags ‘ in Single Post template(single.php).
Here is the basic span for just the ShareThis button: <span class=””st_sharethis”” st_title='<?php the_title(); ?>’ st_url='<?php the_permalink(); ?>’ displayText=””ShareThis””></span>
You can change the class of the span to determine the button that appears. For example class=””st_twitter”” will make a twitter icon and class=””st_email_vcount”” will make a email vertical counter button.
Hope this helps.
Wow, only 9 months to answer this…congrats, that might be a record! 😉
Well, no, not really. If you re-read what I posted, my issue isn’t with adding the ShareThis buttons; I’ve done this plenty of times. My issue is that even when you implement it on posts only, it still loads all your files (1 JS, 1 CSS)…if I’m not using ShareThis on this page, I don’t want its 13kb of files and 2 HTTP requests.
And because you hard-code the <script> in your plugin – instead of using the likes of
wp_enqueue_style(like you’re meant to) – I can’t use any WordPress functions / conditional logic to stop it from firing.
I know this plug-in is meant to cater for everyone, including the novices, but the way this plug-in works as a “install-and-forget” plug-in completely kills any possibility of using it in a real project.
Anyway, nevermind because I’m now using Socialite.js
- The topic ‘Can we please cut down on the bloat?’ is closed to new replies.