Skip to content

Instantly share code, notes, and snippets.

View aj-adl's full-sized avatar
💅
vibing

Alex James Bishop aj-adl

💅
vibing
View GitHub Profile
@aj-adl
aj-adl / jQuery-noConflict-wrapper.js
Created January 13, 2015 22:39
Standard jQuery noConflict wrapper - waits till $.ready event before executing. Very common in WP JS code
jQuery(document).ready(function($) {
// Inside of this function, $() will work as an alias for jQuery()
// and other libraries also using $ will not be accessible under this shortcut
// Put your code here e.g. $('#page').find('.comments').each( myFunc()); etc
});
@aj-adl
aj-adl / 0_reuse_code.js
Created November 4, 2015 05:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@aj-adl
aj-adl / excludes.conf
Created December 14, 2017 02:16
bitbucket-sage-rsync
/node_modules
/bower_components
/assets
.git*
@aj-adl
aj-adl / git-deploy-branch.sh
Created February 13, 2018 06:51
Command to automate branch switching and merging when using deployment braches
#!/usr/bin/env bash
function gdpl (){
set -e
local RED=`tput setaf 1`
local GREEN=`tput setaf 2`
local BLUE=`tput setaf 6`
local YELLOW=`tput setaf 3`
local PURPLE=`tput setaf 5`
@aj-adl
aj-adl / hide-admin.php
Created May 2, 2019 04:56
Hide the ACF menu in the Wordpress admin.
<?php
function my_namespace_remove_acf_from_admin_menu(){
/* How you determing if it's production or not is up to you, we set a constant */
if ( ! defined( 'WP_ENV' ) || WP_ENV !== 'production ) return;
/* You can whitelist some users by id, or with a little more code, their username etc*/
$whitlisted_users = [];
@aj-adl
aj-adl / facewp-multi-filter.js
Created July 7, 2020 08:39
Fix for Facet WP - enable the use of multiple instances of the same facet on a single page
/* Example shows how to do it with checkboxes */
$(document).on('facetwp-loaded', function {
/* deregister the click handler for the filter(s) you're targeting */
$(document).off( 'click', '.facetwp-type-checkboxes .facetwp-checkbox:not(.disabled)');
/* register our own */
$(document).on('click', '.facetwp-type-checkboxes .facetwp-checkbox:not(.disabled)', my_custom_handle_facet_click );
} );