Skip to content

Instantly share code, notes, and snippets.

View pippinsplugins's full-sized avatar

Pippin Williamson pippinsplugins

View GitHub Profile
anonymous
anonymous / gist:4526094
Created January 13, 2013 20:34
<?php
//add_action( 'wp_head', 'tgm_delete_all_orders' );
function tgm_delete_all_orders() {
21
$payments = get_posts( array( 'post_type' => 'edd_payment', 'posts_per_page' => -1, 'post_status' => 'any' ) );
$downloads = get_posts( array( 'post_type' => 'download', 'posts_per_page' => -1 ) );
if ( $downloads ) {
foreach ( $downloads as $download ) {
delete_post_meta( $download->ID, '_edd_download_sales' );
@pippinsplugins
pippinsplugins / gist:4704632
Last active July 19, 2017 03:37
Add custom payment method icons to Easy Digital Downloads
<?php
/**
* Register the payment icon
*/
function pw_edd_payment_icon($icons) {
$icons['url/to/your/image/icon.png'] = 'Name of the Payment Method';
return $icons;
}
add_filter('edd_accepted_payment_icons', 'pw_edd_payment_icon');
@Rarst
Rarst / CommentsFeed.php
Last active July 28, 2021 10:27
Build Gist comments feed for specific user, using GitHub API.
<?php
namespace Rarst\GitHub\Gist;
use GuzzleHttp\Client;
use GuzzleHttp\Command\Guzzle\Description;
use GuzzleHttp\Command\Guzzle\GuzzleClient;
/**
* Build Gist comments feed for specific user, using GitHub API.
@thefuxia
thefuxia / t5-silent-flush.php
Last active August 11, 2016 11:03
T5 Silent Flush - Flushes rewrite rules whenever a custom post type or taxonomy is registered and not already part of these rules. This is a soft flush, the .htaccess will not be rewritten.
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Silent Flush
* Description: Flushes rewrite rules whenever a custom post type or taxonomy is registered and not already part of these rules. This is a soft flush, the .htaccess will not be rewritten.
* Version: 2013.05.04
* Author: Thomas Scholz <info@toscho.de>
* Author URI: http://toscho.de
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
@bradyvercher
bradyvercher / infinite-wp-list-tables.php
Last active December 20, 2015 08:39
WordPress Plugin: Infinite scroll support for WP List Tables in the WordPress admin panel.
<?php
/**
* Plugin Name: Infinite WP List Tables
* Description: Infinite scroll support for WP List Tables in the WordPress admin panel.
* Version: 0.1.0
* Author: Brady Vercher
* Author URI: http://www.blazersix.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@samikeijonen
samikeijonen / licence-limit.php
Created July 31, 2013 07:10
Add license limit UI for variable prices and show license key limit in [purchase_history] shortcode.
<?php
/**
* Show license key limit in [purchase_history] shortcode.
*
* @since 0.1.0
*/
function edd_site_count_downloads_license_limit_th() {
echo '<th class="edd-site-count-site-count">' . __( 'Site Count', 'edd-site-count' ) . '</th>';
@jdevalk
jdevalk / discount_url.php
Created August 14, 2013 09:34
Allow specification of a discount coupon through the URL, this means we can do away with the coupon field in the checkout process.
<?php
/**
* Allow people to specify a coupon code in the URL, and add it to their cart.
*/
function yst_edd_discount_link() {
if ( isset( $_GET['coupon'] ) ) {
// Check whether it's a valid coupon, if so, add it to the cart.
if ( edd_is_discount_valid( $_GET['coupon'] ) )
edd_set_cart_discount( $_GET['coupon'] );
@jdevalk
jdevalk / EDD_AJAX_non_ssl_filter.php
Created August 14, 2013 09:36
Make sure the AJAX URL for EDD uses the protocol for the current page, either http or https, as it doesn't work otherwise.
<?php
/**
* Make sure the AJAX URL for EDD uses the protocol for the current page, either http or https, as it doesn't work otherwise.
*
* @param string $ajaxurl The current ajaxurl
*
* @return string
*/
function yst_filter_edd_ajax_url( $ajaxurl ) {
@danielbachhuber
danielbachhuber / gist:6719651
Created September 26, 2013 19:54
Automatically append mtime to script and style versions for cache-busting action
<?php
/** Automatically append mtime to script and style versions for cache-busting action **/
add_action( 'wp_enqueue_scripts', function() {
global $wp_styles, $wp_scripts;
foreach( array( 'wp_styles', 'wp_scripts' ) as $resource ) {
foreach( $$resource->registered as $name => $registered_resource ) {
// Not hosted here
@GaryJones
GaryJones / class-gamajo-template-loader.php
Created December 9, 2013 16:17
Separate out the template loader class into a generic class for all plugins, and a specific one for this plugin.
<?php
/**
* Template Loader for Plugins
*
* @package Template_Loader_For_Plugins
* @author Gary Jones
* @link http://gamajo.com/template-loader
* @copyright 2013 Gary Jones
* @license GPL-2.0+
*/