This file contains 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
Hey! Just to let you know there is a much better version of this script that doesn't require jQuery here: | |
https://gist.github.com/edadams/5ce1ec3d0b1f69e80724af7eb3b606f4 | |
For posterity, and because this Gist got unexpectedly popular for a random code snippet, I will preserve the original below. Please do know that I've figured out a much better way to do this, which is above. | |
$(function(){ // shorthand document.ready() | |
$('.make_lightbox').each(function(){ // this is just an element I let them click, it carries a series of data- attributes. | |
$(this).on('click',function(){ // when clicked. this is the newer jQuery click() handler that's only in v1.8+ so that may be something to note. | |
var lbArray = []; // create blank array. | |
var arrayContents = {"width":$(this).data('width'), "height":$(this).data('height'), "low_res":$(this).data("lowres"), "high_res":$(this).data('highres')}; // make set of the data- attributes. |
This file contains 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 count = 2; // How many photos do you wanna display | |
var igToken = "371393934.dba0291.7da640d4c8fc4ff3a205f2e290eae6f1"; // DON'T USE MY ACCESS TOKEN. Generate your own, http://instagram.com/developer | |
var igUserId = "371393934"; // This is easy to generate, I've made a thing http://themes.edada.ms/instagram-auth | |
$.ajax({ | |
url: 'https://api.instagram.com/v1/users/'+igUserId+'/media/recent/?access_token='+igToken+'&callback=?', | |
data: { | |
'count': count | |
}, | |
dataType: "jsonp", |
This file contains 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
<article class="{PostType}{block:Photoset}set{/block:Photoset}"> | |
{block:Text} | |
<div class="inner"> | |
<h2{block:Title} class="has-body"{/block:Title}>{Title}</h2> | |
<div class="body"> | |
{Body} | |
</div> | |
</div> | |
{/block:Text} | |
This file contains 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
{block:Photoset} | |
<div class="media{block:Caption} has-caption{/block:Caption}"> | |
<div class="photoset-grid" data-layout="{PhotosetLayout}" style="visibility: hidden;"> | |
{block:Photos} | |
<img src="{PhotoURL-500}" {block:HighRes}data-highres="{PhotoURL-HighRes}"{/block:HighRes} data-width="{PhotoWidth-HighRes}" data-height="{PhotoHeight-HighRes}" {block:Caption}alt="{Caption}"{/block:caption} /> | |
{/block:Photos} | |
</div> | |
</div> | |
{block:Caption} | |
<div class="inner"> |
This file contains 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
{block:ContentSource}(Source: <a href="{SourceURL}">{SourceTitle}</a>{block:RebloggedFrom}, via <a href="{ReblogParentURL}">{ReblogParentName}</a>{/block:RebloggedFrom}){/block:ContentSource} |
This file contains 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
if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { | |
document.documentElement.classList.add('is-safari'); | |
} | |
/** | |
* Credits: | |
* http://stackoverflow.com/questions/5899783/detect-safari-using-jquery | |
* https://developer.mozilla.org/en/docs/Web/API/Element/classList | |
*/ |
This file contains 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
/** | |
* Media query mixin so we don't need to duplicate breakpoints throughout stylesheets. | |
* | |
* It's better to use em for breakpoints instead of px where possible. | |
* http://bradfrost.com/blog/post/7-habits-of-highly-effective-media-queries/#relative | |
* | |
* .example { | |
* @include media-query(phone OR tablet OR desktop) { | |
* color: blue; | |
* } |
This file contains 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
<html> <!-- There's no need to set a doctype, Tumblr automatically injects one. --> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="description" content="{MetaDescription}"> | |
<link rel="alternate" href="{RSS}"> | |
<link rel="icon" href="{Favicon}"> | |
<style> | |
{CustomCSS} | |
</style> | |
</head> |
This file contains 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 wbsuk_change_no_shipping_error() { | |
return '<div class="no-shipping-text">Your order cannot be completed automatically. Please <a href="contact">contact us</a> and we will confirm a price to ship to you.</div>'; | |
} | |
add_filter( 'woocommerce_cart_no_shipping_available_html', 'wbsuk_change_no_shipping_error' ); | |
add_filter( 'woocommerce_no_shipping_available_html', 'wbsuk_change_no_shipping_error' ); |
This file contains 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> | |
let clbPhotos = document.querySelectorAll('.page-index .photo-image[data-highres]'); // Replace this with the selector for whatever you want to be the trigger. | |
Array.prototype.forEach.call(clbPhotos, function(clbElement, i){ | |
clbElement.addEventListener('click', function(){ | |
let clbAttrs = clbElement.dataset; | |
let clbData = [{ | |
"width": clbAttrs.highresWidth, | |
"height": clbAttrs.highresHeight, | |
"low_res": clbElement.src, // My trigger is the image element so I can take the existing src that is currently being displayed. This is quite good for performance because I know that version is already loaded in. If you make the trigger anything else, you'll need to find another way to provide the low resolution version, it's not optional. | |
"high_res": clbAttrs.highres |
OlderNewer