When someone clicks your Pinterest sharing button, Shared Counts uses the current post’s featured image as the image, and the current post’s title as the description. Want a more descriptive description? The code below will use the featured image’s description if provided, and if empty it will fall back to the post title.
Author: Bill Erickson
Bill Erickson is a freelance WordPress developer and a contributor to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.
Include Shared Counts styles when loaded via AJAX
Shared Counts only loads its styles if the share buttons are called in the current page. If you’re loading them via AJAX, they wouldn’t be in place on initial load. You can resolve this by telling Shared Counts the buttons are loading on the page. Add this to your theme’s functions.php file: This will load the styles […]
Setting up reCAPTCHA v2 – “I’m not a robot” checkbox
When you include the Email sharing button, Shared Counts will recommend you Enable Email reCAPTCHA. If you don’t enable reCAPTCHA, bots could use your email sharing form for spam which could make your site appear to be spammy in the eyes of Google and email clients. It can also slow down your server if bots […]
Creating new button styles
Shared Counts includes many style options built-in, but you can also create your own custom styles using the shared_counts_styles filter. The styles are added as a class on the .shared-counts-wrap container. If you’re using the “Fancy” style, it adds a class of .style-fancy which you can use to target CSS (example). The following code adds […]
Shared Counts 1.3: Twitter counts, Google Analytics integration, and more
We just released version 1.3 of Shared Counts, which includes some great new features and improvements. Twitter counts using TwitCount Our previous provider of Twitter share counts shut down, so we’ve added support for the new leader in Twitter counts, TwitCount. Sign up for free on the TwitCount website, then on your website go to […]
Disable the plugin’s CSS and JavaScript
Shared Counts loads a stylesheet which contains the styling for the many style options offered by this plugin. You can prevent our stylesheet with the following code: Make sure you include your own styling for the Shared Counts buttons in your theme’s stylesheet. Disable JavaScript Shared Counts includes a JavaScript file for the following functionality: […]
Change how often share counts refresh
Shared Counts uses smart caching to minimize API queries since they can slow down the load time for visitors. We refresh recent content more often. Posts published in the last 24 hours are updated every 30 minutes Posts published in the last 5 days are updated every 6 hours Posts older than that are updated […]
Display list of popular posts sorted by share count
Shared Counts stores the total share count as post metadata using the shared_counts_total key. This lets you easily query for popular content Query with code To query for a list of your posts with the highest share count: You can also combine this with more advanced queries. Here’s a list of posts published in the […]
Display different buttons in each location
In Settings > Shared Counts you can control the site-wide settings for which share buttons are shown and where they appear (before and/or after content). For more fine grained control, you can use the shared_counts_display_services filter (added in version 1.3) to customize which services are available in each location. You might also be interested in […]
Use different button styles before and after content
In Settings > Shared Counts you can select a button style and whether they appear above and/or below the post content. But what if you want to use different button styles in those locations? You can use the shared_counts_theme_locations filter to customize the settings for each location. Let’s say you want to use the “Classic” […]