Skip to content

Instantly share code, notes, and snippets.

View chrisgoddard's full-sized avatar

Chris Goddard chrisgoddard

View GitHub Profile
@chrisgoddard
chrisgoddard / load
Created June 19, 2015 16:53
Async Script Loader
(function(a,b,c,e,d){a=b.createElement(c);
b=b.getElementsByTagName(c)[0];
a.async=1;d&&(a.onload=d);a.src=e;b.parentNode.insertBefore(a,b)
})(window,document,"script","//example.com/script", function callback(){});
Twitter
https://twitter.com/intent/tweet?text=$TITLE$&url=$URL$&via=$TWITTERHANDLE$
Facebook
http://www.facebook.com/sharer/sharer.php?u=$URL$
Google Plus
@chrisgoddard
chrisgoddard / wp-utilities.php
Last active January 7, 2021 01:55
WordPress Utility Functions
<?php
/*
* @name: WordPress utility functions
* @desc: Useful utility functions for WordPress
* @author: https://github.com/chrisgoddard
*/
/*
@chrisgoddard
chrisgoddard / wpexternalapi.php
Last active October 10, 2016 11:15
WordPress External API endpoint class
/*
WpExternalApi class use
$api = WpExternalApi::get('url-slug');
will create endpoint at www.example.com/url-slug/json and www.example.com/url-slug/xml
$api->set_logic(callback);
function callback($input){
@chrisgoddard
chrisgoddard / calltrackingmetrics-gaid-snippet
Last active August 29, 2015 14:04
Push Google Analytics clientId parameter to calltrackingmetrics.com platform
// paste this in footer - should be after Google Analytics and CallTrackingMetrics snippets.
var __ctm_cvars = __ctm_cvars || [];
ga(function(tracker) {
var MyID = tracker.get('clientId');
__ctm_cvars.push({gaid: MyID });
});