This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Add "Create Scheduled Action" page | |
* Plugin URI: https://gist.github.com/JPry/357ee26a46e3d8e2b68d1690f5bbbf75 | |
* Description: Add a page to the Tools menu that allows for the manual creation of scheduled actions with Action | |
* Scheduler. Version: 1.0.0 | |
* Author: Jeremy Pry | |
* Author URI: https://jeremypry.com/ | |
* License: MIT | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Example including a JS file into WordPress. | |
*/ | |
add_action( 'wp_enqueue_scripts', 'jpry_example_include_scripts' ); | |
function jpry_example_include_scripts() { | |
wp_enqueue_script( | |
'jpry-example-script', // This is an arbitrary name to reference this particular script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: JPry local tweaks. | |
* Plugin URI: https://gist.github.com/JPry/623fbbff1d008f783f2406711e4a6813 | |
* Description: Local development tweaks. Place this in the mu-plugins directory. | |
* Version: 1.0 | |
* Author: Jeremy Pry | |
* Author URI: http://jeremypry.com/ | |
* License: MIT | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Allow orders created by an admin to be paid without the user logging in. | |
* | |
* @param array $allcaps All capabilities of the user. | |
* @param array $caps Capabilities requested. | |
* @param array $args Extra Arguments. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# Ensure we have the `hub` command available. | |
if ! [[ -x "$(command -v hub)" ]]; then | |
echo "Error: 'hub' is required" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Send an email each time an order with coupon(s) is completed | |
* | |
* The email contains coupon(s) used during checkout process | |
* | |
* @param int $order_id The ID of the order. | |
*/ | |
function jp_email_order_coupons( $order_id ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace JPry; | |
use JPry\Exception\InvalidField; | |
class Example { | |
/** | |
* Generate the sub-field objects for this field. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wcs_default_retry_rules', 'jpry_limit_3_retries' ); | |
/** | |
* Limit the WooCommerce Subscriptions retry system to only 3 retries. | |
* | |
* This keeps the existing retry rules, but only the first 3. Everything thereafter | |
* is discarded. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_customer_changed_subscription_to_cancelled', 'customer_skip_pending_cancellation' ); | |
/** | |
* Change 'pending-cancel' status directly to 'cancelled'. | |
* | |
* @param WC_Subscription $subscription | |
*/ | |
function customer_skip_pending_cancellation( $subscription ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// PR #237 broke Valet+ custom drivers, this is a workaround. | |
if ( ! class_exists( 'WordPressValetDriver' ) ) { | |
$driverPath = realpath( $_SERVER['HOME'] ) . '/.composer/vendor/weprovide/valet-plus/cli/drivers/WordPressValetDriver.php'; | |
if ( ! is_readable( $driverPath ) ) { | |
throw new Exception( 'Unable to load the WordPress Valet Driver.' ); | |
} | |
require_once $driverPath; |
NewerOlder