Skip to content

Instantly share code, notes, and snippets.

View dancameron's full-sized avatar
💭
🍻Cheersing

Dan Cameron dancameron

💭
🍻Cheersing
View GitHub Profile
<?php // don't include this line in your functions.php, since it already starts with it.
function fee_line_item_types( $types = array() ) {
$types = array(
'task' => __( 'Task', 'sprout-invoices' ),
'service' => __( 'Service', 'sprout-invoices' ),
'product' => __( 'Product', 'sprout-invoices' ),
'fee' => __( 'Fees', 'sprout-invoices' ),
);
@dancameron
dancameron / functions.php
Created January 6, 2020 19:55
Error Logging for Help Scout Desk Troubleshooting
<?php // don't include this in your functions.php, since the start of the file should already have it
function _hsd_api_log( $data, $endpoint ) {
error_log( '************* HSD API LOG *************' );
error_log( 'data' . print_r( $data, true ) );
error_log( 'endpoint' . print_r( $endpoint, true ) );
error_log( '************* HSD API LOG END *************' );
}
add_filter( 'hsd_v2_api_request_params', '_hsd_api_log', 10, 2 );
add_filter( 'hsd_v2_api_request', '_hsd_api_log', 10, 2 );
@dancameron
dancameron / functions.php
Created January 2, 2020 17:27
Set Default Min Payment Amount Due
<?php // don't include this line in your functions.php, since it already starts with it.
function _change_status_of_invoice_submission( SI_Invoice $invoice ) {
update_post_meta( $invoice->get_id(), '_si_client_set_payment', 1 );
}
add_action( 'si_gravity_forms_integration_invoice_created', '_change_status_of_invoice_submission' );
@dancameron
dancameron / functions.php
Created December 13, 2019 18:49
Remove Duplicate Column Headers
<?php // don't include this line in your functions.php, since it already starts with it.
add_filter( 'si_show_all_line_item_headers', '__return_false' );
@dancameron
dancameron / functions.php
Last active December 12, 2019 23:14
Suppress Notifications
<?php // don't include this in your functions.php, since the start of the file should already have it
add_filter( 'suppress_notifications', '__return_true' );
@dancameron
dancameron / functions-original-and-slate-themes.php
Last active December 3, 2019 15:58
Adds a print button to the top of estimates and invoices.
/**
* Adds a print button to the top of estimates and invoices.
* @return type
*/
function si_print_button() {
// check to see if PDF view
if ( isset( $_GET['genpdf'] ) ) {
return;
}
@dancameron
dancameron / style.css
Created November 27, 2019 16:52
Pagination CSS
.pages .pagination {
display: block;
clear: both;
}
.pages .pagination a {
color: #60A7FC;
background-color: #F9FCFF;
border-color: transparent;
}
@dancameron
dancameron / functions.php
Created November 15, 2019 18:38
Get all Dashboard Links
<?php // don't include this line in your functions.php, since it already starts with it.
remove_action( 'pre_si_invoice_view', array( 'SI_Payment_Terms_Fees', 'show_message_about_term_due' ), 20, 1 );
function _si_get_user_dashboard_links() {
if ( class_exists( 'SI_Client_Dashboard' ) ) {
$args = apply_filters( 'si_get_users_for_association_args', array( 'fields' => array( 'ID', 'user_email', 'display_name' ) ) );
$users = get_users( $args );
@dancameron
dancameron / functions.php
Created November 12, 2019 17:10
Remove Payment Terms Header Messages
<?php // don't include this line in your functions.php, since it already starts with it.
remove_action( 'pre_si_invoice_view', array( 'SI_Payment_Terms_Fees', 'show_message_about_term_due' ), 20, 1 );
@dancameron
dancameron / functions.php
Created November 12, 2019 17:03
Don't Show Payment Term Fee Labels if Zero
<?php // don't include this line in your functions.php, since it already starts with it.
function si_change_doc_fees_labels( $fees, $doc ) {
foreach ( $fees as $key => $fee ) {
$fees[ $key ]['always_show'] = 0;
}
return $fees;
}
add_filter( 'si_doc_fees', 'si_change_doc_fees_labels', 100, 2 );