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.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' );
@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-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
Custom States and Countries for Sprout Invoices
<?php
/**
* This function file is loaded after the parent theme's function file. It's a great way to override functions, e.g. add_image_size sizes.
*
*
*/
function custom_states() {
return array(
@mauriciogofas
mauriciogofas / functions.php
Last active August 29, 2015 14:14 — forked from dancameron/functions.php
Default Money Formatting for the BR in Sprout Invoices
<?php
// Brazilian money simbol in Sprout Invoices
function set_br_reais_localeconv( $locale = array() ) {
$locale = array(
'decimal_point' => '.',
'thousands_sep' => '',
'int_curr_symbol' => 'BRL',
'currency_symbol' => 'R$',
'mon_decimal_point' => ',',
'mon_thousands_sep' => '.',
@mauriciogofas
mauriciogofas / functions.php
Last active August 29, 2015 14:14 — forked from dancameron/functions.php
Modify client dashboard date format in Sprout Invoices
<?php
function change_client_dash_date_format() {
return 'd/m/Y';
}
add_filter( 'si_client_dash_date_format', 'change_client_dash_date_format' );
@mauriciogofas
mauriciogofas / gist:7cfc8e03aaf107d75e36
Last active August 29, 2015 14:14
Default WP From email
<?php
//Default From mail
function custom_wp_mail_from( $email ) {
$handle = 'site';
$find = 'http://www.';
$replace = '';
$link = get_bloginfo( 'url' );
$domain = str_replace( $find, $replace, $link );
return $handle . '@' . $domain ;
}
@mauriciogofas
mauriciogofas / gist:6a00b76d8563b23940b4
Created February 5, 2015 15:55
Testing your WordPress email settings for the wp_mail function
<?php
/**
* Credit: http://www.butlerblog.com/2012/09/23/testing-the-wp_mail-function/
* Update variable settings.
* Load to your WP root folder.
*/
// Set $to as the email you want to send the test to
$to = "email@domain.com";
@mauriciogofas
mauriciogofas / gist:06a61720ab725c7d33e1
Created February 5, 2015 15:57
Custom WP Admin Footer
<?php
// Admin Footer
add_filter( 'admin_footer_text', 'my_footer_text' );
add_filter( 'update_footer', 'my_footer_version', 11 );
function my_footer_text() {
return '&nbsp;';
}
function my_footer_version() {
return 'Your New Prhase';
@mauriciogofas
mauriciogofas / gist:72a42180f5ff539b831a
Created February 5, 2015 15:59
Custom "howdy user" wp-admin Bar
<?php
// Saudação customizada pt_BR
function replace_howdy( $wp_admin_bar ) {
$my_account=$wp_admin_bar->get_node('my-account');
$newtitle = str_replace( 'Olá', 'Bem vindo', $my_account->title );
$wp_admin_bar->add_node( array(
'id' => 'my-account',
'title' => $newtitle,
) );
}