Skip to content

Instantly share code, notes, and snippets.

View addisonhall's full-sized avatar

Addison Hall addisonhall

View GitHub Profile
@addisonhall
addisonhall / web.config
Last active November 24, 2018 21:45
WordPress on IIS web.config with headers and cache control. Be sure to update "http://mydomain.com" with your site domain.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="Vary"></remove>
<add name="Vary" value="Accept-Encoding"></add>
</customHeaders>
</httpProtocol>
<staticContent>
@addisonhall
addisonhall / wp_query-orderby-meta-1.php
Last active June 29, 2021 17:58
WP_Query: Orderby custom fields
<?php
$args = array(
'post_type' => 'custom_post_name' // including the post type name seems to make this not work!
'meta_key' => 'custom_field_name',
'orderby' => 'meta_value',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'custom_tax_name',
@addisonhall
addisonhall / bespoke-shopify-macro.php
Last active October 27, 2016 15:45
Bespoke Shipping macro for Shopify -- specify perishable goods and restrict shipping choices
<?php
/* This macro will be parsed as PHP code (see http://www.php.net)
The calculateshipping function is called every time a shipping calculation request is made by Shopify.
The function must return an array of available shipping options, otherwise no shipping options will be returned to your customers.
*/
function calculateshipping($DATA) {
/* do not edit above this line */
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
@addisonhall
addisonhall / _helpers.scss
Last active March 20, 2017 05:17
Simple SASS starter files
// Social media fontawesome colors
a .fa-square { color: #fff; }
a .fa-twitter-square, a .fa-twitter { color: #00aced; }
a .fa-facebook-square, a .fa-facebook { color: #3b5998; }
a .fa-youtube-square, a .fa-youtube { color: #bb0000; }
a .fa-google-plus-square, a .fa-google-plus { color: #dd4b39; }
a .fa-linkedin-square, a .fa-linkedin { color: #007bb6; }
a .fa-pinterest-square, a .fa-pinterest { color: #cb2027; }
a .fa-vimeo-square, a .fa-vimeo { color: #aad450; }
a .fa-instagram { color: #517fa4; }
@addisonhall
addisonhall / ee-solspace-calendar-example.php
Created November 2, 2015 14:05
Added PHP function to deal with DST discrepancy when importing from Google Calendar
{layout="site/.layout_default" body_class="events"}
{preload_replace:pre_channel_name="events"}
{preload_replace:pre_section_title="Events"}
{layout:set name="section_title" value="{pre_section_title}"}
<?php
function adjust_dst($this_date, $this_hour) {
$check_dst = new DateTime($this_date . ' America/Chicago');
@addisonhall
addisonhall / content-announcements.php
Last active October 22, 2015 16:11
WP page template with custom query for announcments
<?php
/**
* Template part for displaying announcements.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package chapel
*/
?>
@addisonhall
addisonhall / check-size-and-orientation.js
Last active January 16, 2017 11:28
Get screen width, height, and orientation
// ----------------------------------------------
// Detect screen orientation
// ----------------------------------------------
var deviceOrientation = ''; // Declare globally to use throughout
function detectOrientation () {
var windowWidth = $(window).height();
var windowHeight = $(window).width();
if (windowWidth > windowHeight) {
deviceOrientation = 'landscape';
} else {
@addisonhall
addisonhall / check-screen-dimensions.js
Last active August 29, 2015 14:22
Get screen size (width and height)
// ----------------------------------------------------
// Check screen size
// ----------------------------------------------------
var windowWidth = $(window).width();
var windowHieght = $(window).height();
window.addEventListener("resize", function () {
windowWidth = $(window).width();
windowHeight = $(window).height();
});
@addisonhall
addisonhall / detect-orientation.js
Last active January 16, 2017 11:30
Detect screen orientation (landscape or portrait)
// Declare globally to use throughout
var deviceOrientation = '';
// ----------------------------------------------------
// Detect screen orientation
// ----------------------------------------------------
function detectOrientation() {
var height = $(window).height();
var width = $(window).width();
if(width > height) {