Skip to content

Instantly share code, notes, and snippets.

View pramod1988's full-sized avatar

pramod pandey pramod1988

View GitHub Profile
@jasondavis
jasondavis / Demo-Usage.php
Last active September 26, 2021 22:05
Social Network Share Count for a URL - PHP Class
<?php
/*
Example Usage passing in Array of netowrks we want countsa for...
$socialCounts = new socialNetworkShareCount(array(
'url' => 'http://www.codedevelopr.com/',
'facebook' => true,
'twitter' => true,
'pinterest' => true,
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@wycks
wycks / gist:2315295
Created April 6, 2012 00:08
Rewrite static theme assets and plugins directory (WordPress)
<?php
// rewrite /wp-content/themes/theme-name/css/ to /css/
// rewrite /wp-content/themes/theme-name/js/ to /js/
// rewrite /wp-content/themes/theme-name/img/ to /img/
// rewrite /wp-content/plugins/ to /plugins/
function roots_flush_rewrites() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
}