Skip to content

Instantly share code, notes, and snippets.

View petertwise's full-sized avatar

Peter Wise petertwise

View GitHub Profile
@petertwise
petertwise / acf-install-license
Last active January 19, 2024 14:48 — forked from polevaultweb/acf_pro_license_constant.php
Define the Advanced Custom Fields Pro license key with a constant
#!/bin/bash
# Setup ACF Pro to use a license key in wp-config
#
# 1. Place your license key in a file called .acf-license-key somewhere your ssh user has access to it.
# Default is in your home directory: ~/.acf-license-key
# Change the setting below if you need to put it somewhere else
# 2. install this file in /usr/local/bin or someplace in your PATH
# 3. make sure you have WP CLI installed
# 4. run acf-install-license from the root of your wordpress install
@petertwise
petertwise / git-updater-ignore.php
Created January 11, 2024 03:17 — forked from afragen/git-updater-ignore.php
A plugin to ignore specific repositories from Git Updater
<?php
/**
* Plugin Name: Git Updater Ignore
* Plugin URI: https://gist.github.com/afragen/414612961ac500b652862096a54d62d7
* Description: This plugin is used to set Git Updater to ignore specific repository slugs.
* Version: 0.3
* Author: Andy Fragen
* License: MIT
* Requires at least: 5.2
* Requires PHP: 5.6
@petertwise
petertwise / plusminus.html
Last active July 14, 2023 03:56 — forked from Farmatique/gist:5c48d1d9b5744117a94901f6ed84f7b5
input[type="number"] plus/minus buttons
<div id="field1">
<button type="button" id="sub" class="sub">-</button>
<input type="text" id="1" value="0" class="field" />
<button type="button" id="add" class="add">+</button>
</div>
@petertwise
petertwise / give_anonymous_email_tag.php
Last active June 13, 2020 17:36 — forked from rickalday/give_anonymous_email_tag.php
GiveWP Anonymous Donation Email Tag
<?php
// Plugin Name: GiveWP Add Email Tag for Anonymous Checkbox
function give_anonymous_email_tag( $email_tags ) {
// Adds an email tag called {give_anonymous_status} to indicate whether the donor opted in or not.
$email_tags[] = array(
'tag' => 'give_anonymous_status', // The tag name.
'desc' => __( 'This outputs whether the donor opted-in to the anonymous option', 'give' ), // For admins.
'func' => 'render_give_anonymous_status_email_tag', // Callback to function below.
'context' => 'donation',
);
@petertwise
petertwise / gist:b30a253fa087c66bfe33e34f4e3df998
Created August 24, 2017 15:52 — forked from icemancast/gist:d94c2fcfe5ccf073330aab4a7d55765b
WooCommerce: change "add to cart" button text by product type
<?php
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
/**
* custom_woocommerce_template_loop_add_to_cart
*/
function custom_woocommerce_product_add_to_cart_text() {
global $product;
$product_type = $product->get_type();