Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Iterates over results of a query, split into many queries via LIMIT and OFFSET
*/
class QueryIterator implements Iterator {
var $limit = 500;
var $query = '';
var $global_index = 0;
@adamloving
adamloving / temporary-email-address-domains
Last active April 16, 2025 06:03
A list of domains for disposable and temporary email addresses. Useful for filtering your email list to increase open rates (sending email to these domains likely will not be opened).
0-mail.com
0815.ru
0clickemail.com
0wnd.net
0wnd.org
10minutemail.com
20minutemail.com
2prong.com
30minutemail.com
3d-painting.com
@jameskoster
jameskoster / functions.php
Created January 12, 2013 16:01
WooCommerce - hide ratings on product loop
// Remove the product rating display on product loops
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
@retgef
retgef / wp-config-switcher.php
Last active December 11, 2015 02:59
For use with multiple sub-folder WordPress installations. This allows you to store all wp-config.php in any folder on your server. WP config files are renamed to correspond with the server name. This approach helps you protect your wp-config files when you have multiple docroots in one folder.
<?php
# ------------------
# no shenanigans
# ------------------
if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { die(); }
# ---------------
# server name
# ---------------
$server = $_SERVER['SERVER_NAME'];
<?php
function array_sort(&$array)
{
return usort($array, 'array_compare');
}
function array_asort(&$array)
{
return uasort($array, 'array_compare');
}
@deckerweb
deckerweb / contactform7.php
Created January 28, 2013 21:47
Contact Form 7 plugin: Clean up global scripts & styles.
<?php
add_action( 'wp_enqueue_scripts', 'ddw_cf7_cleanup' );
/**
* Contact Form 7 plugin: Cleanup global scripts & styles.
*
* @author David Decker - DECKERWEB
* @link http://deckerweb.de/twitter
*/
function ddw_cf7_cleanup() {
@scribu
scribu / test.php
Created February 8, 2013 03:12
Simulate threads in PHP using only proc_open() and co.
<?php
include __DIR__ . '/threads.php';
$commands = array();
for ( $i=0; $i<10; $i++ ) {
$commands[] = "bash -c 'sleep `shuf -i 1-5 -n 1`; echo $i'";
}
@raideus
raideus / acf-auto-export.php
Created March 7, 2013 06:00
This collection of functions completely automates the "Export to PHP" feature of Advanced Custom Fields. No more manual copy + pasting! Simply specify an absolute file path (line 17) and the code will automatically write the ACF data to the file. The export is initiated whenever you publish a new field group or save changes to an existing field …
<?php
/**
* Automated PHP export for Advanced Custom Fields
*
* Export is initiated whenever an admin publishes a new field group
* or saves changes to an existing field group.
*
* Place this code in your theme's functions.php file.
*
*/
@iwek
iwek / php-curl.php
Created March 8, 2013 15:11
PHP Curl Example with Error Checking
<?php
//initialize
$ch = curl_init();
// 2. set the options, including the url
curl_setopt($ch, CURLOPT_URL, "https://api.pingdom.com/api/2.0/traceroute?host=techslides.com");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("App-Key: YOUR-KEY-HERE"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
@dmassiani
dmassiani / pagenavi html
Created April 2, 2013 07:33
Change html for wp pagenavi
######################
# Change html pagenavi for transform like bootstrap
######################
//attach our function to the wp_pagenavi filter
add_filter( 'wp_pagenavi', 'wd_pagination', 10, 2 );
//customize the PageNavi HTML before it is output
function wd_pagination($html) {
$out = '';