Skip to content

Instantly share code, notes, and snippets.

View kosmiq's full-sized avatar

Tor Raswill kosmiq

  • KPMG Sweden Lighthouse
  • Sweden
View GitHub Profile
@kosmiq
kosmiq / wp_custom_meta_box_specific_page
Created April 16, 2015 20:39
WordPress: Display custom Meta box on specific page template only
/*awesome tip from http://www.paulund.co.uk/display-post-meta-box-specific-page-templates*/
add_action('add_meta_boxes', 'add_product_meta');
function add_product_meta()
{
global $post;
if(!empty($post))
{
$pageTemplate = get_post_meta($post->ID, '_wp_page_template', true);
@kosmiq
kosmiq / js_gmaps_iframe.js
Last active August 29, 2015 14:17
Add Google Maps via JS to avoid hidden iFRAMES on mobile
/**
* Outputs the Google Maps iframe.
*/
gmapiframe = function() {
var iframe = document.createElement('iframe');
iframe.frameBorder=0;
iframe.border=0;
iframe.width="600px"; //set width
iframe.height="450px"; //set height
iframe.id="gmap-iframe";
@kosmiq
kosmiq / js_google_fonts_async_ieshim
Last active October 17, 2017 11:34 — forked from thomasmb/gist:b67680a04ae75bc301b7
An updated version of Thomas Bensmanns Load Google Fonts via JS (https://bensmann.no/google-webfonts-performance/) with a SHIM for IE9 and IE8.
WebFontConfig = {
google: { families: [ \'Ek+Mukta:200,800:latin\' ] }
};
var cb = function() {
var wf = document.createElement(\'script\');
wf.src = \'//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js\';
wf.type = \'text/javascript\';
wf.async = \'true\';
var s = document.getElementsByTagName(\'script\')[0];
s.parentNode.insertBefore(wf, s);