Skip to content

Instantly share code, notes, and snippets.

View claudiosanches's full-sized avatar
👨‍💻

Claudio Sanches claudiosanches

👨‍💻
View GitHub Profile
@claudiosanches
claudiosanches / jigoshop-pagseguro-fix-product-addons.php
Created November 27, 2012 03:30
Jigoshop - Adds Products Add-ons like new products in the cart Jigoshop PagSeguro.
<?php
/**
* Plugin Name: Jigoshop PagSeguro Fix Produdt Add-ons
* Plugin URI: http://www.claudiosmweb.com/
* Description: Adds Products Add-ons like new products in the cart Jigoshop PagSeguro.
* Author: claudiosanches
* Author URI: http://www.claudiosmweb.com/
* Version: 1.1
* License: GPLv2 or later
*/
@claudiosanches
claudiosanches / functions.php
Created November 29, 2012 00:09
Print table view
/**
* Print table view.
*/
function cs_show_table_in_description() {
global $wcCreditCardInterestTable;
echo $wcCreditCardInterestTable->print_view();
}
add_action( 'woocommerce_single_product_summary', 'cs_show_table_in_description', 15 );
@claudiosanches
claudiosanches / boleto.php
Created November 30, 2012 03:56
Exemplo de templage page
<?php
/*
* Template Name: Boleto
*/
// Validação exemplo:
if ( isset( $_GET['id'] ) $_GET['id'] && != '' ) {
wp_die( 'Explicação do erro' );
}
@claudiosanches
claudiosanches / functions.php
Created November 30, 2012 13:40
WooCommerce - Alter add to cart text
/**
* Alter add to cart text.
*
* @return string New text.
*/
function alter_add_to_cart_text() {
return __( 'Or&ccedil;a' );
}
add_filter( 'single_add_to_cart_text', 'alter_add_to_cart_text' );
@claudiosanches
claudiosanches / functions.php
Created November 30, 2012 14:43
Wordpress - Custom mail settings
<?php
/**
* Custom Mail from name
*
* @param string $name Old from name.
*
* @return string New from name.
*/
function cs_custom_mail_from_name( $name ) {
return 'Nome do jovem ou do blog';
@claudiosanches
claudiosanches / update.sql
Created December 1, 2012 00:40
WooCommerce - Update , to .
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ',', '.') WHERE meta_key = '_price';
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ',', '.') WHERE meta_key = '_regular_price';
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ',', '.') WHERE meta_key = '_sale_price';
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ',', '.') WHERE meta_key = '_min_variation_price';
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ',', '.') WHERE meta_key = '_max_variation_price';
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ',', '.') WHERE meta_key = '_min_variation_regular_price';
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ',', '.') WHERE meta_key = '_max_variation_regular_price';
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ',', '.') WHERE meta_key = '_min_variation_sale_price';
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ',', '.') WHERE meta_key = '_max_variation_sale_price';
@claudiosanches
claudiosanches / comments.php
Created December 1, 2012 16:09
Wordpress - Remove comments notes
<?php comment_form( array( 'comment_notes_after' => '' ) ); ?>
@claudiosanches
claudiosanches / functions.php
Created December 1, 2012 20:59
WooCommerce - Custom Simple Product price format.
<?php
/**
* Custom simple product price format.
*
* Adds credit cart parcels in price html.
*
* @param string $price Old price format.
*
* @return string Price format with credit card parcels.
*/
@claudiosanches
claudiosanches / theme-options-functions.php
Created December 1, 2012 21:16
WordPress - Theme Settings Framework
<?php
// Esse é o arquivo com a base das funções.
// Tente não alterar ele.
/**
* Theme Options Functions
*/
/**
* Load options scripts
@claudiosanches
claudiosanches / functions.php
Created December 1, 2012 22:06
WooCommerce - Updated Clint Points
<?php
function cs_updated_client_points( $order_id ) {
global $woocommerce;
// Cria logs de para debugar o código.
// Os logs irão para wp-content/plugins/woocommerce/logs/testando.txt
// Você precisa dar permissão de escrita nesta pasta para funcionar!
$log = $woocommerce->logger();
// Nome do custom field que iremos usar para salvar no perfil do usuário: