Skip to content

Instantly share code, notes, and snippets.

View MWDelaney's full-sized avatar

Michael W. Delaney MWDelaney

View GitHub Profile
@MWDelaney
MWDelaney / advanced-custom-fields.php
Last active February 20, 2019 14:51
Advanced Custom Fields drop-in functionality for Sage 9
<?php
namespace App;
/**
* Advanced Custom Fields drop-in functionality for Sage 9
* Version: 1.0
* Author: Michael W. Delaney
*/
@MWDelaney
MWDelaney / beaver-branding.php
Created November 3, 2016 18:01
Force Beaver Builder Branding
<?php
/*
Plugin Name: Beaver Builder branding for my agency
Plugin URI:
Description: Force the branding of the Beaver Builder plugin
Version: 1.0
Author: Michael W. Delaney
Author URI:
License: MIT
*/
@MWDelaney
MWDelaney / functions.php
Last active February 6, 2025 07:53
WooCommerce: Prevent multiple coupons of the same "type" on a single order. This will, for instance, prevent coupon stacking if a customer or user has access to multiple Product % Discount or Cart % Discount coupons. Tested working with WooCommerce, WooCommerce Smart Coupons, and WooCommerce Points & Rewards
<?php
// Hook when a coupon is applied to a cart
add_action( 'woocommerce_applied_coupon', 'mwd_get_applied_coupons' );
// Get the current applied coupon and compare it with other applied coupons
function mwd_get_applied_coupons() {
// Get the currently applied coupon's type using the $_POST global to retrieve the current coupon's code
foreach ( WC()->cart->get_coupons() as $code => $coupon ) {
if($coupon->code == $_POST['coupon_code']) {
@MWDelaney
MWDelaney / uploads.yml
Created April 9, 2016 03:36 — forked from louim/uploads.yml
Drop-in playbook for Trellis to push and pull uploads from the server to your local machine.
---
- name: Sync uploads between environments
hosts: web
remote_user: "{{ web_user }}"
vars:
project: "{{ wordpress_sites[site] }}"
project_root: "{{ www_root }}/{{ site }}"
tasks:

Keybase proof

I hereby claim:

  • I am mwdelaney on github.
  • I am mwdelaney (https://keybase.io/mwdelaney) on keybase.
  • I have a public key whose fingerprint is 609B D3F0 4057 15CD 9433 01E5 1848 2240 DB98 A03C

To claim this, I am signing this object:

@MWDelaney
MWDelaney / wp_cpt_portfolio.php
Last active April 25, 2021 03:23
WordPress Custom Post Type and Shortcode for Portfolio Items
<?php
/*
Plugin Name: Custom Post Type - Portfolio Items
Plugin URI:
Description: Custom Post Types and shortcodes for Portfolio Items.
Version: 1.0
Author: Michael W. Delaney
Author URI:
*/