Skip to content

Instantly share code, notes, and snippets.

View scottparry's full-sized avatar

Scott Parry scottparry

View GitHub Profile
@scottparry
scottparry / gutenberg-test-post
Created August 30, 2019 16:24
Welcome to the Gutenberg Editor
<!-- wp:cover {"url":"https://cldup.com/Fz-ASbo2s3.jpg"} -->
<div class="wp-block-cover has-background-dim" style="background-image:url(https://cldup.com/Fz-ASbo2s3.jpg)"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
<p style="text-align:center" class="has-large-font-size">Of Mountains &amp; Printing Presses</p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover -->
<!-- wp:paragraph -->
<p>The goal of this new editor is to make adding rich content to WordPress simple and enjoyable. This whole post is composed of <em>pieces of content</em>—somewhat similar to LEGO bricks—that you can move around and interact with. Move your cursor around and you’ll notice the different blocks light up with outlines and arrows. Press the arrows to reposition blocks quickly, without fearing about losing things in the process of copying and pasting.</p>
<!-- /wp:paragraph -->
@scottparry
scottparry / mobile-detect.js
Created June 15, 2019 07:50
Detect Mobile
var isMobile = { Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); },
iOS: function() { return navigator.userAgent.match(/iPhone|iPod/i); },
Opera: function() { return navigator.userAgent.match(/Opera Mini/i); },
Windows: function() { return navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/WPDesktop/i); },
any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); }
};
@scottparry
scottparry / functions.php
Created February 21, 2018 07:04
Enqueue Google fonts in WordPress theme
/**
* Enqueue custom fonts using protocol relative URL.
*
* Syntax: wp_enqueue_style( $handle, $src, $deps, $ver, $media );
* Ensure $handle is unique to prevent conflicts with plugins
*
* Note(s): The pipe (|) operator is used to load multiple typefaces in a single call. We also only load the weights we want * by comma seperating them, instead of loading every available weight.
*/
function theme_prefix_fonts()
{