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 | |
/** | |
* Register plugin icons. | |
* | |
* WordPress 4.9 introduced icons in the list table on the Manage Plugins | |
* screen. The icons are pulled from the W.org update API. If an icon isn't | |
* available, a generic plugin Dashicon is shown instead. | |
* | |
* @param array $value Plugin update data. | |
* @return array |
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
/** | |
* Redirect the user to the appropriate page upon login. | |
*/ | |
add_filter( 'login_redirect', function( $url, $query, $user ) { | |
if ( is_wp_error( $user ) ) { | |
return $url; | |
} | |
if ( current_user_can('administrator') ) { | |
return $url; |
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: EDD Prompt Login On Checkout | |
Plugin URI: http://brianhogg.com/ | |
Description: Prompt login if email exists | |
Author: Dave Kiss | |
Version: 1.0.0 | |
Author URI: http://brianhogg.com | |
License: GPL2 | |
*/ |
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 | |
// Quick and dirty *AUTOMATIC* upgrade-only discount for EDD (no discount code) | |
class SearchwpUpgradeDiscount { | |
private $upgrade_discount = 30; // 30% discount | |
private $applicable = false; | |
function __construct() { | |
add_filter( 'edd_get_cart_content_details_item_discount_amount', function( $discount, $item ) { |
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 | |
/** | |
* Easy Digital Downloads provides packages URLs that look something like this: | |
* | |
* http://mysite.com/edd-sl/package_download/MTQ4NjA1NTA0NjphMDA5MTkzZjQ0NGRiNmVmMzczY2JhNTFiZWIxMWZiYzo0NzM3MzphM2Q5ZDA3NDQwMjZjZDFmOWVhYTBiNzBjMjVlZjI0YjpodHRwQC8vbXVzaWNmZXN0aXZhbC5zY2hvb2wubno | |
* | |
* This generates a temporary filename for the update process that look something like this: | |
* | |
* MTQ4NjA1NTA0NjphMDA5MTkzZjQ0NGRiNmVmMzczY2JhNTFiZWIxMWZiYzo0NzM3MzphM2Q5ZDA3NDQwMjZjZDFmOWVhYTBiNzBjMjVlZjI0YjpodHRwQC8vbXVzaWNmZXN0aXZhbC5zY2hvb2wubno.tmp | |
* |
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 | |
// Prevent license renewal when associated subscription is failing | |
// (it will cause double charges and double subscriptions and waste a lot of your time) | |
add_action( 'edd_pre_add_to_cart', function( $download_id, $options ) { | |
// Only applicable if this is a renewal. | |
if ( empty( $options['is_renewal'] ) ) { | |
return; | |
} |
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
/** | |
* Add a weekly email report that summarizes which domains that | |
* your products are being used on. | |
*/ | |
add_filter( 'cron_schedules', function( $schedules ) { | |
$schedules['weekly'] = array( | |
'interval' => 604800, | |
'display' => __('Once Weekly') | |
); |
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
#!/bin/bash | |
# Context: https://jamiehall.cc/2020/03/10/delete-all-your-tweets-with-one-line-of-bash/ | |
# https://news.ycombinator.com/item?id=22689746 | |
twurl "/1.1/statuses/user_timeline.json?screen_name=YOUR_TWITTER_HANDLE&count=200&max_id=$(twurl '/1.1/statuses/user_timeline.json?screen_name=YOUR_TWITTER_HANDLE&count=200&include_rts=1' | jq -r '.[9]|.id_str')&include_rts=1" | jq -r '.[]|.id_str' | parallel -j 10 -a - twurl -X POST /1.1/statuses/destroy/{1}.json > /dev/null |
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
# This is a template .gitignore file for git-managed WordPress projects. | |
# | |
# Fact: you don't want WordPress core files, or your server-specific | |
# configuration files etc., in your project's repository. You just don't. | |
# | |
# Solution: stick this file up your repository root (which it assumes is | |
# also the WordPress root directory) and add exceptions for any plugins, | |
# themes, and other directories that should be under version control. | |
# | |
# See the comments below for more info on how to add exceptions for your |
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
# Steps we will take: | |
# 1. Change Local (Docker Machine) image type (this will take a bit) | |
# 2. Resize image | |
# 3. Resize partion | |
# | |
# Also see: https://docs.docker.com/articles/b2d_volume_resize/ | |
# IMPORTANT: Make sure Local is not running! | |
VM_NAME="local-by-flywheel" | |
NEW_DISK_SIZE=50000 |