This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 }); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* @name: WordPress utility functions | |
* @desc: Useful utility functions for WordPress | |
* @author: https://github.com/chrisgoddard | |
*/ | |
/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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(){}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getUrlParam(url, param) { | |
var match = url.match('(?:\\?|&)' + param + '=([^&#]*)'); | |
return (match && match.length == 2) ? decodeURIComponent(match[1]) : ''; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var docWidth = document.documentElement.offsetWidth; | |
[].forEach.call( | |
document.querySelectorAll('*'), | |
function(el) { | |
if (el.offsetWidth > docWidth) { | |
console.log(el); | |
} | |
} | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple regex/user agent mobile checker | |
* about 99% accurate when compared to 175k sessions in GA | |
*/ | |
function isMobile() | |
{ | |
return window.navigator.match(/Mobi|Touch|Opera\ Mini|Android/) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function(){ | |
var data = { | |
"@context": "http://schema.org", | |
"@type": "BlogPosting", | |
"mainEntityOfPage": { | |
"@type": "WebPage", | |
"@id": {{Page URL}} | |
}, | |
"headline": {{SCHEMA - Article Headline}}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Extract domain from string (with or without protocol) | |
[?:http(s)?:\/\/]?([a-z0-9\-]+\.?[a-z0-9\-]+\.[a-z]{2,3}) |
OlderNewer