This file contains hidden or 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
<?php | |
/** | |
* Attaches ACF fields to single posts | |
* | |
* Filters output from http://wordpress.org/extend/plugins/json-api/o | |
* Requires ACF plugin | |
*/ | |
function attach_acf_fields($response) { | |
// We need ACF plugin |
This file contains hidden or 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 gulp = require('gulp'); | |
var plumber = require('gulp-plumber'); // used for error catching during watch | |
var sass = require("gulp-sass"); | |
var changed = require('gulp-changed'); // only move changed files | |
var replace = require("gulp-replace"); | |
var concat = require("gulp-concat"); | |
var sourcePaths = { | |
styles: ['./scss/*.scss'], | |
scripts: ['./js/savings_slider.js', './js/jw_custom.js'], |
This file contains hidden or 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
// Clear local storage is hash in URL is #clear_ls | |
if( window.location.hash.toLowerCase() == "#clear_ls" ) { | |
localStorage.clear(); | |
console.log('local storage cleared'); | |
} |
This file contains hidden or 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
https://github.com/Huddle/PhantomCSS | |
npm install phantomcss | |
sudo npm install -g casperjs | |
sudo npm install -g phantomjs | |
create minimally viable testsuite.js: | |
========= |
This file contains hidden or 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
<?php | |
$resource_terms = get_terms( 'section' ); | |
// Sort terms by description field | |
function description_compare($a, $b) { | |
return $a->description - $b->description; | |
} | |
usort($resource_terms, "description_compare"); | |
?> | |
<div class="resource-filter"> | |
<a href="#" class="resource-filter-term" data-filter="article" data-filter-by=".resource">All</a> |
This file contains hidden or 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 gulp = require('gulp'); | |
var plumber = require('gulp-plumber'); // used for error catching during watch | |
var less = require('gulp-less'); | |
var swig = require('gulp-swig'); | |
var webserver = require('gulp-webserver'); | |
var changed = require('gulp-changed'); // only move changed files | |
var opn = require('opn'); // for opening the browser | |
var sourcePaths = { | |
styles: ['less/**/*.less'], |
This file contains hidden or 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
# Test for placeholder support | |
inputTest = document.createElement('input') | |
if inputTest.hasOwnProperty('placeholder') | |
$('html').addClass('placeholder') | |
else | |
$('html').addClass('no-placeholder') |
This file contains hidden or 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
<?php | |
// Function to regenerate the data and save the transients | |
function special_query(){ | |
$special_query_results = new WP_Query( 'cat=5&order=random&tag=tech&post_meta_key=thumbnail' ); | |
set_transient( 'special_query_results' , $special_query_results, 12 * HOUR_IN_SECONDS ); | |
set_transient( 'special_query_results_no_expire' , $special_query_results, 99 * YEAR_IN_SECONDS ); | |
return $special_query_results; | |
} | |
// Get any existing copy of our transient data |
This file contains hidden or 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
<?php | |
function truncate_with_end ($string, $max = 200, $rep = '') { | |
$len = strlen ($string); | |
if( $len <= $max ){ | |
return $string; | |
} | |
$leave = $max - strlen ($rep); | |
return substr_replace($string, $rep, $leave); | |
} |
This file contains hidden or 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
<?php | |
/* | |
Debug preview with custom fields | |
Taken from: http://support.advancedcustomfields.com/forums/topic/preview-solution/ | |
See also: http://support.advancedcustomfields.com/forums/topic/2nd-every-other-post-preview-throws-notice/ | |
*/ | |
add_filter('_wp_post_revision_fields', 'add_field_debug_preview'); | |
function add_field_debug_preview($fields){ | |
$fields["debug_preview"] = "debug_preview"; | |
return $fields; |