⌘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
<?php // don't include this line in your functions.php, since it already starts with it. | |
function process_ninja_form_and_create_invoice( $entry = array() ) { | |
$fields = $entry['fields_by_key']; | |
$address = array( | |
'street' => $fields['address_1530704017856']['value'], | |
'city' => $fields['city_1530704053248']['value'], | |
'zone' => '', |
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
/** | |
* Auto Complete all WooCommerce orders. | |
*/ | |
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order', 1 ); | |
function custom_woocommerce_auto_complete_order( $order_id ) { | |
if ( ! $order_id ) { | |
return; | |
} | |
$order = wc_get_order( $order_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 | |
///////// | |
// API // | |
///////// | |
public static function get_tags_from_help_scout( $flush = false ) { | |
$tag_cache = get_option( self::TAGS_CACHE, false ); |
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
$invoice_id = 559 ; | |
$invoice = SI_Invoice::get_instance( $invoice_id ); | |
//print_r($invoice); | |
$amount = 100 ; | |
$transaction_id = '1' ; | |
$date = '2011-12-22 12:00:00'; | |
$notes = 'CASH' ; | |
$number = ''; | |
$payment_id = SI_Payment::new_payment( array( |
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 | |
$line_items = array(); | |
if ( !empty( $invoice_itemized_list ) ) { | |
foreach ( $invoice_itemized_list as $key => $item ) { | |
$line_items[] = array( | |
'rate' => ( isset( $item['price'] ) ) ? $item['price'] : '', | |
'qty' => ( isset( $item['quantity'] ) ) ? $item['quantity'] : '', | |
'desc' => ( ! isset( $item['description'] ) || ! isset( $item['name'] ) ) ? "missing name or description" : '<strong>'.$item['name'].'</strong><br/>'.$item['description'], | |
'type' => 'task', // task, service, product, or time |
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 | |
/** | |
* Hook into all Gravity Form submissions, check to see if the form id | |
* matches the one we want to generate an invoice from, and process the | |
* submission if appropriate. | |
* | |
* @param arrat $entry Array of the GF entry | |
* @return null | |
*/ |
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 | |
/* Template Name: Dashboard */ | |
$current_user = wp_get_current_user(); | |
$user_id = $current_user->ID; | |
$client_ids = SI_Client::get_clients_by_user( $user_id ); | |
if ( empty( $client_ids ) ) { | |
$client = Sprout_Client::get_instance( $client_ids[0] ); | |
$phone = $client->get_phone(); |
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 // 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' ); |
NewerOlder