Skip to content

Instantly share code, notes, and snippets.

@mattmckenny
mattmckenny / bootstrap-less-inline-media-query
Created March 18, 2015 13:41
Bootstrap/Less mixin to add responsive media query within original selector's declaration
//
// Load core variables
// --------------------------------------------------
@import "variables.less";
.breakpoint(@class, @rules) when (@class = xs) {
@media (min-width: @screen-xs-min) and (max-width: @screen-xs-max) {@rules();}
}
.breakpoint(@class, @rules) when (@class = sm) {
@mattmckenny
mattmckenny / gist:0fb7f3ac2dfe3a26c31d
Last active August 29, 2015 14:11
WordPress : Always force original domain when previewing posts and pages when using domain mapping
<?php
/**
* Forces original site for previewing posts and pages when using domain mapping
*
* @return URL of preview link using original site
**/
function original_site_preview_link($url, $post) {
$parts = parse_url($url);
@mattmckenny
mattmckenny / ie force edge in wordpress
Created September 10, 2014 14:05
IE force edge in WordPress
<?php
// Forces edge in IE browsers
add_filter('wp_headers', 'bf_ie_add_header');
function bf_ie_add_header($headers) {
if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
$headers['X-UA-Compatible'] = 'IE=edge,chrome=1';
}
return $headers;
}
@mattmckenny
mattmckenny / gcalendar-wrapper fix
Created November 2, 2010 16:23
This code is a fix which retries up to ten times to retrieve Google Calendar in the gcalendar-wrapper.php script.
/**
* Retrieve calendar embedding code
*/
$calRaw = '';
if (in_array('curl', get_loaded_extensions())) {
//counter for retry attempts
$i = 1;
//Let's act like a request has been made and returned error 302 so we process first attempt
$status['http_code'] = '302';