⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; '. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function filter_term_archive( $query ) { | |
if ( $query->is_tax('your_taxonomy') ) { | |
$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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Usage: | |
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL | |
if ( !$frag->output() ) { // NOTE, testing for a return of false | |
functions_that_do_stuff_live(); | |
these_should_echo(); | |
// IMPORTANT | |
$frag->store(); | |
// YOU CANNOT FORGET THIS. If you do, the site will break. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Example filter will translate/change the string "Description". | |
* "Description" can be changed to whatever string you'd like to translate/change | |
* just make sure to change the function name so you don't have any conflicts. | |
*/ | |
function l10n_description( $text ) { | |
return 'Beschrijving'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // don't include this in your functions.php | |
// add new item type (working) | |
function add_sizeproduct_line_item_type( $types = array() ) { | |
$types = array_merge( $types, array( 'sizeproduct' => __( 'Size Product' ) ) ); | |
return $types; | |
} | |
add_filter( 'si_line_item_types', 'add_sizeproduct_line_item_type' ); |
OlderNewer