Skip to content

Instantly share code, notes, and snippets.

View gregrickaby's full-sized avatar
:octocat:

Greg Rickaby gregrickaby

:octocat:
View GitHub Profile
@gregrickaby
gregrickaby / wp-query-ref.php
Created June 27, 2017 15:24 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@gregrickaby
gregrickaby / php-array-isset-vs-empty.md
Last active May 4, 2020 19:43 — forked from efuller/array.md
PHP Array isset and empty

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@gregrickaby
gregrickaby / jsClass.jQuery.js
Created January 11, 2016 17:15 — forked from aubreypwd/jsClass.jQuery.js
How to create a Js application as a jQuery plugin
( function( $ ) {
// Create a jQuery Object.
$.fn.myObject = function() {
var target = this; // Store the target element in this variable (jQuery stuff).
// Our stuff.
this.object = {
/**
@gregrickaby
gregrickaby / myObject.js
Created January 11, 2016 16:07
Creating a global Js Object
// Create an object in the global scope, pass in window, jQuery, and the global object into the anonymous function.
window.myObject = ( function( window, $, myObject ) {
// Create our object, properties, and functions.
myObject = {
window: $( window ), // Remove if you don't need it, makes your object smaller.
// Access variables using myObject.options
options {

Disable Plugins

Quickly disable all plugins in WordPress.

Usage

This plugin needs to go into the wp-content/mu-plugins/ directory. Provided you have SSH access to the server where WordPress lives, you can do this:

cd $SITE_ROOT/wp-content/mu-plugins
/**
* fixMSWord
*
* Replace ascii chars with utf8. Note there are ascii characters that don't
* correctly map and will be replaced by spaces.
*
* Updated 7-15-2015 by Jay Wood to encode lower end items into HTML entity counterparts.
*
* @author Robin Cafolla,Jay Wood
* @date 2013-03-22
@gregrickaby
gregrickaby / example-nginx.conf
Last active November 22, 2020 20:24 — forked from pmgarman/gist:8fba357c97193633a66d
Defer the loading of images to the production server. Use either Apache or NGINX depending on your local server setup.
################################################################
# Example configuration file for nginx
#
# To add a new local WordPress domain to your environment, copy
# this file using a filename that matches the domain you wish to
# setup. For example - mylocaldomain.com.conf would be an ideal
# filename for http://mylocaldomain.com
#
# Once copied, you will need to modify two settings in the server
# configuration provided:
@gregrickaby
gregrickaby / .htaccess
Last active September 14, 2020 09:25 — forked from nickdavis/gist:10525079
Redirect local /wp-content/uploads to the development server
#301 Redirect Local Images to Live
RedirectMatch 301 ^/wp-content/uploads/(.*) http://livewebsite.com/wp-content/uploads/$1