Skip to content

Instantly share code, notes, and snippets.

View markusvonplunkett's full-sized avatar

Mark Plunkett markusvonplunkett

View GitHub Profile
@markusvonplunkett
markusvonplunkett / main.js
Created September 8, 2015 11:10
Enquire Modernizr Example
Modernizr.load([
//first test need for polyfill
{
test: window.matchMedia,
nope: "/js/vendor/media.match.js",
both: "/js/vendor/enquire.js",
complete : function () {
enquire.register("screen and (min-width:43.750em)", {
// OPTIONAL
// If supplied, triggered when a media query matches.
defaults write com.apple.finder AppleShowAllFiles YES
@markusvonplunkett
markusvonplunkett / useragent.js
Created September 25, 2015 15:38
IE10-11-12 Detection
var useragent = navigator.userAgent;
var result;
//run regex test for rv:11 or like Gecko
//
switch (result)
{
case 'ie10': $('html').addClass('ie10');
break;
case 'ie11': $('html').addClass('ie11');
@markusvonplunkett
markusvonplunkett / appear.js
Created September 2, 2016 11:18
Customised Appear Script
/* @group appear */
/*
* jQuery.appear
* http://code.google.com/p/jquery-appear/
*
* Copyright (c) 2009 Michael Hixson
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
*
* http://www.3magine.com
* Modified by Karl Schellenberg
@markusvonplunkett
markusvonplunkett / calling.the.function.js
Created November 17, 2016 10:05
Foundation Media Query JS Detection
// Docs on how to query the data: http://foundation.zurb.com/sites/docs/media-queries.html
if (SOZO.MediaQuery.atLeast('medium')) {
// DO X AND Y
}
@markusvonplunkett
markusvonplunkett / Display a fallback Alt tag
Created May 4, 2017 11:37
Display a fallback Alt tag if none is present. Ideally clients should be instructed on how to add media with the relevant alt tags.
/**
* Display a fallback Alt tag if none is present. Ideally clients should be instructed on how to add media with the relevant alt tags.
*/
function sz_wp_get_attachment_image_attributes ( $attr, $attachment, $size ) {
global $post;
if ( empty($attr['alt']) ){
// $attr['alt'] = 'hardcord fallback';
// $attr['alt'] = get_field('heading', $post->ID);
@markusvonplunkett
markusvonplunkett / Old
Created May 4, 2017 11:41
Old way of getting an alt tag
$body_image_1 = wp_get_attachment_image_src( get_field('body_image_1'), 'medium_landscape_1' );
$body_image_2 = wp_get_attachment_image_src( get_field('body_image_2'), 'medium_landscape_1' );
<img src="<?php echo $body_image_1[0]; ?>" alt="<?php echo $body_image_1['alt']; ?>" />
// Combines SVGs into a single file using SYMBOLS and then inserts it into templates/svg-icons.php
gulp.task('svgstore', function () {
var svgs;
svgs = gulp
.src(path.source+'/images/svg_icons/*.svg')
.pipe(rename({prefix: 'icon-'}))
// .pipe(function() {
// return gulpif(enabled.svgMinify, svgmin({}));
// })
.pipe(svgstore({ inlineSvg: true }));
// Remove H1 and H2 options from TinyMCE
function my_format_TinyMCE( $init ) {
$init['block_formats'] = "Paragraph=p; Heading 3=h3; Heading 4=h4; Preformatted=pre";
return $init;
}
add_filter( 'tiny_mce_before_init', __NAMESPACE__ . '\\my_format_TinyMCE');}
@markusvonplunkett
markusvonplunkett / footer-js.js
Created August 15, 2017 10:41
Moving JS Files to Footer Wordpress