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( 'woocommerce_checkout_fields', function ( $fields ) { | |
$offset = 2; //Change this by the field position you want to add (remembering it starts from zero) | |
$custom_field_id = 'billing_wcj_checkout_field_1'; //Your custom field id | |
$oldArray = $fields['billing']; | |
$custom_field = array( $custom_field_id => $oldArray[ $custom_field_id ] ); | |
$newArray = array_slice( $oldArray, 0, $offset, true ) + $custom_field + array_slice( $oldArray, $offset, null, true ); | |
$fields['billing'] = $newArray; | |
return $fields; | |
}, PHP_INT_MAX ); |
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
/** | |
* Convert a string to Boolean. | |
* It handles 'True' and 'False' Strings written as Lowercase or Uppercase. | |
* It also detects '0' and '1' Strings | |
*/ | |
function convertToBoolean(variable){ | |
variable = variable.toLowerCase(); | |
return Boolean(variable == true | variable === 'true'); | |
} |
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( 'wp_get_nav_menu_items', function($items, $menu, $args){ | |
if($menu->name!='Rodapé-3'){ | |
return $items; | |
} | |
if(is_admin()){ | |
return $items; | |
} | |
$contactDetails = get_option('contact'); |
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
//Colocar na opcao Additional JavaScript, dentro do admin | |
a2a_config.icon_color = "#B93437"; |
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 | |
/* | |
$terms = | |
Array | |
( | |
[2] => WP_Term Object | |
( | |
[term_id] => 6 | |
) |
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
#TEST1 | |
SELECT wp_posts.post_title, t.name | |
FROM wp_posts | |
LEFT JOIN wp_term_relationships tr ON tr.object_id=wp_posts.ID | |
LEFT JOIN wp_term_taxonomy tt ON tt.term_taxonomy_id=tr.term_taxonomy_id AND tt.taxonomy='shopping_list_tax' | |
LEFT JOIN wp_terms t ON t.term_id=tt.term_id | |
WHERE 1=1 AND wp_posts.post_type = 'shopping_list_sg' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') | |
ORDER BY wp_posts.post_date DESC | |
#TEST 2 |
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
#COMMIT AND PUSH ALL SUBMODULES | |
#In Main project | |
git submodule foreach 'git add .' #recursively add files in submodules | |
git submodule foreach 'git commit -a -m "Altered submodule" || :' | |
git add --all :/ | |
git commit -am "Altered submodule" | |
git push --recurse-submodules=on-demand |
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 | |
//Adiciona as informacoes bancarias na pag do pedido | |
add_action('woocommerce_view_order',function($order_id){ | |
//echo '<hr style="border-top:1px solid #ccc;margin-top:10px;margin-bottom:30px" />'; | |
$order=new WC_Order( $order_id ); | |
if ( $order->payment_method !== 'bacs') return; | |
$bacs = new WC_Gateway_BACS(); | |
$bacs->thankyou_page( $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 | |
/** | |
* Adds CNPJ and Company Name fields on the Thank You page and Order Received Email when using 'Direct Bank Transfer' payment gateway. | |
*/ | |
add_filter( 'woocommerce_bacs_account_fields', function ( $fields ) { | |
$fields['cnpj']['label'] = __( 'CNPJ', 'domain' ); | |
$fields['cnpj']['value'] = '99.999.999/9999-99'; | |
$fields['company_name']['label'] = __( 'Razao Social', 'domain' ); | |
$fields['company_name']['value'] = 'Uma empresa doce e bacana Ltda'; | |
return $fields; |
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
// Remove WooCommerce Updater | |
remove_action('admin_notices', 'woothemes_updater_notice'); |