Skip to content

Instantly share code, notes, and snippets.

View pippinsplugins's full-sized avatar

Pippin Williamson pippinsplugins

View GitHub Profile
@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
*/
@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
*/
@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.
@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');
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' );
<?php
/*
Plugin Name: Easy Digital Downloads - Variable Pricing License Activation Limits
Plugin URL: http://easydigitaldownloads.com/extension/
Description: Limit the number of license activations permitted based on variable prices
Version: 1.0
Author: Pippin Williamson
Author URI: http://pippinsplugins.com
Contributors: mordauk
*/
@benjaminprojas
benjaminprojas / divide_money_evenly.php
Last active April 7, 2023 11:20
Function to divide money (numbers with 2 decimal points) as evenly as possible between any given number of recipients
<?php
echo nl2br(print_r(divide_money_evenly((float)(string) 78.23, 3), true));
function divide_money_evenly($number, $divided_by, $numbers=array()) {
$total = 0;
for($i=1; $i<=$divided_by; $i++) {
if(abs($number - $total) != 0) {
$divided = $number / $divided_by;
if($divided < 1) {
$rounded = 0;
}
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active December 25, 2023 06:46
Using Git with Subversion Mirroring for WordPress Plugin Development
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@joncave
joncave / endpoints.php
Created June 7, 2012 19:41
WP_Rewrite endpoints demo
<?php
/*
Plugin Name: WP_Rewrite endpoints demo
Description: A plugin giving example usage of the WP_Rewrite endpoint API
Plugin URI: http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/
Author: Jon Cave
Author URI: http://joncave.co.uk/
*/
function makeplugins_endpoints_add_endpoint() {