Skip to content

Instantly share code, notes, and snippets.

View mauriciogofas's full-sized avatar

Mauricio Gofas mauriciogofas

View GitHub Profile
@mauriciogofas
mauriciogofas / functions.php
Last active August 29, 2015 14:14 — forked from dancameron/functions-original-and-slate-themes.php
Adds a print button to the top of estimates and invoices.
<?php
/**
* Adds a print button to the top of estimates and invoices.
* @return type
*/
function si_print_button() {
?>
<a href="javascript:window.print()" id="print_button" class="button print_button"><?php si_e('Imprimir') ?></a>
<?php
@mauriciogofas
mauriciogofas / functions.php
Last active August 29, 2015 14:14 — forked from dancameron/functions.php
Translating Strings in Sprout Invoices
<?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';
@mauriciogofas
mauriciogofas / functions.php
Last active August 29, 2015 14:14 — forked from dancameron/functions.php
Redirect Away if not logged in and redirect back
<?php
function si_redirect_if_not_logged_in() {
$url = get_permalink( $invoice_id );
if ( !is_user_logged_in() ) {
wp_redirect( home_url() . '/login/?redirect_to=' . $url . '&reauth=1');
exit();
}
}
//
add_action( 'pre_si_invoice_view', 'si_redirect_if_not_logged_in' );