Skip to content

Instantly share code, notes, and snippets.

View nelsonJM's full-sized avatar

Josh Nelson nelsonJM

View GitHub Profile
@nelsonJM
nelsonJM / gist:5453561
Created April 24, 2013 16:38
WP: Instant Gallery Plugin
<?php
/**
* Plugin Name: Instant Gallery Plugin
* Description: A plugin for displaying post images in gallery
* Author: Josh Nelson
* Version: 0.1.0
*/
function instant_gallery() {
global $post;
@nelsonJM
nelsonJM / gist:5455541
Created April 24, 2013 21:00
WP:Pull full size images attached to page
<?php
/**
* Plugin Name: Instant Gallery Plugin
* Description: A plugin for displaying post images in gallery
* Author: Josh Nelson
* Version: 0.1.0
*/
function instant_gallery() {
global $post;
@nelsonJM
nelsonJM / gist:5473240
Created April 27, 2013 14:04
HTACCESS:GZIP and browser cache
# Enable GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</ifmodule>
# Expires Headers - 2678400s = 31 days
<ifmodule mod_expires.c>
@nelsonJM
nelsonJM / gist:5491546
Created April 30, 2013 20:09
WordPress: Shortcode Developer for Post Objects
$furniture_galleries = get_field('furniture_galleries');
if( $furniture_galleries ) {
$html .= '<ul class="group stations">';
while(the_repeater_field('furniture_galleries')) {
$fgproduct = get_sub_field('fg_product');
$fgID = $fgproduct->ID;
$fgimage = get_the_post_thumbnail($fgID, 'thumbnail');
$title = get_the_title($fgID);
$firstbullet = get_sub_field('first_bullet');
$secondbullet = get_sub_field('second_bullet');
@nelsonJM
nelsonJM / gist:5510326
Created May 3, 2013 15:59
jQuery: Thumbnail Nav with colorbox
<script>
( function ($) {
$('.window-list.thumbs').on('click','img', function(){ // When someone clicks on a thumbnail
var $this = $(this);
$('#main-image').fadeOut("1000",function() {
@nelsonJM
nelsonJM / gist:5527667
Created May 6, 2013 19:53
HTACCESS:Redirect to Maintenance Page
/* This goes in the htaccess file */
# MAINTENANCE-PAGE REDIRECT
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
RewriteCond %{REQUEST_URI} !/503.php$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /503.php [R=302,L]
</IfModule>
@nelsonJM
nelsonJM / gist:5706837
Created June 4, 2013 15:31
Gruntfile: A gruntfile template
module.exports = function (grunt) {
// Project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';'
},
dist: {
@nelsonJM
nelsonJM / gist:5706862
Created June 4, 2013 15:33
Grunt: An example package json file
{
"name": "my-next-project",
"author": "josh",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-nodeunit": "~0.1.2",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-concat": "~0.3.0",
@nelsonJM
nelsonJM / gist:5706889
Created June 4, 2013 15:36
Compass: An example config rb file
# First, require any additional compass plugins installed on your system.
require 'zurb-foundation'
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"
@nelsonJM
nelsonJM / gist:5751678
Created June 10, 2013 19:51
WordPress: Enqueue scripts and styles
/**
* Enqueue scripts and styles
*/
function steelsentry_theme_scripts() {
wp_enqueue_style( 'steelsentry-theme-style', get_stylesheet_uri() );
wp_enqueue_style( 'app.min', get_template_directory_uri() . '/css/app.min.css' );
wp_enqueue_script( 'steelsentry-theme-js', get_template_directory_uri() . '/js/steelsentry-theme.min.js', array('jquery'), false, true );