Skip to content

Instantly share code, notes, and snippets.

View lukecav's full-sized avatar
🪨
Words of GREAT encouragement!

Luke Cavanagh lukecav

🪨
Words of GREAT encouragement!
View GitHub Profile
@lukecav
lukecav / generate-salts.js
Created February 28, 2017 22:06 — forked from csknk/generate-salts.js
Generate WP Salt Strings
/**
* Simple Javascript that generates WordPress salts
*
* Note that the Javascript version affects uniqueness for some functions - for
* example, `Math.random().toString(36).substring(7);` generates a lot of
* duplicates when using old versions of Node, but over 1M iterations shows
* no duplication in Node v6.2.2. We're not using this method anyway, so this
* note is for academic interest only.
*
* (c) David Egan 2016
@lukecav
lukecav / gravity-forms-material-design.css
Created March 6, 2017 22:32
Styling Gravity Forms with Material Design Look
/*** MAIN WRAPPER ***/
.gform_wrapper {
background: #6000AA;
padding: 5%;
}
/*** REMOVE LABEL FOR PLACEHOLDER ONLY ***/
.gform_wrapper .top_label .gfield_label,
.gform_wrapper .field_sublabel_below .ginput_complex.ginput_container label {
display: none;
@lukecav
lukecav / functions.php
Last active August 22, 2025 11:56 — forked from eteubert/wordpress-passwort-reset-unmultisite.php
WordPress Multisite: Password Reset on a Subsite.
/**
* Password reset on sub site (1 of 4)
* Replace login page "Lost Password?" urls.
*
* @param string $lostpassword_url The URL for retrieving a lost password.
* @param string $redirect The path to redirect to.
*
* @return string
*
* @since 1.0.0
@lukecav
lukecav / fbcbfwss.php
Created March 28, 2017 21:36 — forked from ocean90/fbcbfwss.php
WordPress Plugin: Filename-based cache busting for scripts/styles.
<?php
/**
* Plugin Name: Filename-based cache busting
* Version: 0.3
* Description: Filename-based cache busting for WordPress scripts/styles.
* Author: Dominik Schilling
* Author URI: http://wphelper.de/
* Plugin URI: https://dominikschilling.de/880/
*
* License: GPLv2 or later
@lukecav
lukecav / wp20140226_reset_slugs.php
Created March 29, 2017 18:15 — forked from codearachnid/wp20140226_reset_slugs.php
Reset the slugs on a particular post type to use the default sanitized slugs. To use, add the following code into your theme's functions.php file, ensure that the desired post type is set when calling `wp20140226_reset_slugs('post');` Then navigate to `wp-admin/options-permalink.php` to activate query to reset slugs. Depending on how many posts …
<?php
/**
* Reset the slugs on a particular post type to use the default sanitized slugs
* @param string $post_type filter by post type
* @param int $offset set the paginated post to start
* @param boolean $force_guid_update * WARNING * never enable this
*
* @example add the following code into your theme's functions.php file, ensure
@lukecav
lukecav / gather_discount_coeffs.php
Created June 21, 2017 17:30 — forked from nmenglund/gather_discount_coeffs.php
woocommerce-bulk-discount 2.4.5 performance improvements in gather_discount_coeffs
<?php
/**
* Performance improved gather_discount_coeffs function
* code adapted from woocommerce-bulk-discount 2.4.5
* by Nils Magnus Englund <nme@stepone.no>
*
* NOTE: The code below is only compatible with WooCommerce 3.0 as-is.
* Should be easy enough to backport.
*
@lukecav
lukecav / functions.php
Created June 22, 2017 16:01 — forked from corsonr/functions.php
Display WooCommerce product variations dropdown select on the shop page
<?php
// Display variations dropdowns on shop page for variable products
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' );
function woo_display_variation_dropdown_on_shop_page() {
global $product;
if( $product->is_type( 'variable' )) {
<?php
class ACF_Product_Options {
static $slug = 'hwid_attributes';
public static function init() {
// Gather the global attribute types
$attribute_terms = wc_get_attribute_taxonomy_names();
@lukecav
lukecav / NonAdmin.cmd
Created July 5, 2017 13:49 — forked from ferventcoder/NonAdmin.cmd
Installing Software as a Non-Administrator Using Chocolatey
:: Pick one of these two files (cmd or ps1)
:: Set directory for installation - Chocolatey does not lock
:: down the directory if not the default
SET INSTALLDIR=c:\ProgramData\chocoportable
setx ChocolateyInstall %INSTALLDIR%
:: All install options - offline, proxy, etc at
:: https://chocolatey.org/install
@powershell -NoProfile -ExecutionPolicy Bypass -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH="%PATH%;%INSTALLDIR%\bin"
@lukecav
lukecav / functions.php
Created July 13, 2017 17:21 — forked from mgibbs189/functions.php
FacetWP - WooCommerce Memberships fix
<?php
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) {
if ( 'wc_user_membership' == $query->get( 'post_type' ) ) {
$is_main_query = false;
}
return $is_main_query;
}, 10, 2 );