Skip to content

Instantly share code, notes, and snippets.


Pippin Williamson pippinsplugins

View GitHub Profile
ScottPhillips / .htaccess
Created Feb 2, 2012
Common .htaccess Redirects
View .htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php
#Redirect an entire site:
Redirect 301 /
#Redirect an entire site to a sub folder
Redirect 301 /
Adirael /
Created Aug 17, 2012
Fix wordpress file permissions
# This script configures WordPress file permissions based on recommendations
# from
# 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
jaywilliams / csv_to_array.php
Created Apr 30, 2010
Convert a comma separated file into an associated array.
View csv_to_array.php
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
* Example:
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
kasparsd /
Last active Sep 18, 2020
Using Git with Subversion Mirroring for WordPress Plugin Development
joncave / endpoints.php
Created Jun 7, 2012
WP_Rewrite endpoints demo
View endpoints.php
Plugin Name: WP_Rewrite endpoints demo
Description: A plugin giving example usage of the WP_Rewrite endpoint API
Plugin URI:
Author: Jon Cave
Author URI:
function makeplugins_endpoints_add_endpoint() {
johnbillion /
Last active May 6, 2020
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here:

mvriel / pre-commit.php
Created May 16, 2011
Pre-commit hook for DocBlox
View pre-commit.php
echo PHP_EOL;
// output a little introduction
echo '>> Starting unit tests' . PHP_EOL;
// get the name for this project; probably the topmost folder name
$projectName = basename(getcwd());
benjaminprojas / divide_money_evenly.php
Last active Feb 10, 2019
Function to divide money (numbers with 2 decimal points) as evenly as possible between any given number of recipients
View divide_money_evenly.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;
danielbachhuber / gist:6719651
Created Sep 26, 2013
Automatically append mtime to script and style versions for cache-busting action
View gist:6719651
/** 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
pippinsplugins / gist:4704632
Last active Jul 19, 2017
Add custom payment method icons to Easy Digital Downloads
View gist:4704632
* 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');
You can’t perform that action at this time.