Skip to content

Instantly share code, notes, and snippets.

@sproutventure
sproutventure / gist:1032689
Created June 18, 2011 01:00
WP Affiliate + GBS +Payfast
<?php
add_filter( 'purchase_record_array', 'affiliate_post');
function affiliate_post( $record_array ) {
// Config
$post_url = "http://www.youdeal.co.za/wp-content/plugins/wp-affiliate-platform/api/post.php";
$key = "ijweol383h538t34t9j";
if ( isset($_COOKIE['ap_id'])) {
<?php
function filter_term_archive( $query ) {
if( is_tax( some_custom_post_type_tax_slug() ) ) {
$query->set( 'tax_query', array(
'relation' => 'AND', // Change to OR if we only want to filter one type.
array(
'taxonomy' => some_custom_tax_slug(),
'field' => 'slug',
'terms' => $array_of_terms
@sproutventure
sproutventure / php_helpers.php
Created September 27, 2011 17:06
PHP Dev Helpers
<?php
function pp() {
$msg = __v_build_message(func_get_args());
echo '<pre style="white-space:pre-wrap; text-align: left; '.
'font: normal normal 11px/1.4 menlo, monaco, monospaced; '.
'background: white; color: black; padding: 5px;">'.$msg.'</pre>';
}
function dp() {
$msg = __v_build_message(func_get_args(), 'var_dump');
echo '<pre style="white-space:pre-wrap;; text-align: left; '.
@sproutventure
sproutventure / gist:1435603
Created December 5, 2011 22:08
Require Login on Voucher Claim - GBS
add_action('on_biz_voucher_page','require_login_on_voucher_claim');
function require_login_on_voucher_claim() {
if ( !gb_account_has_merchant() ) {
wp_redirect(gb_get_account_login_url());
exit();
}
}