This file contains hidden or 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 | |
/* | |
Action para não permitir que uma conta seja cadastrada no Woocommerce com um CPF ou CNPJ já existente. | |
Esta action adiciona esta condicional para o campo de CPF ou CNPJ inserido pelo do plugin Extra Checkout Fields for Woocommerce | |
Você pode inserir este código no arquivo functions.php do seu tema. | |
*/ | |
add_action('woocommerce_checkout_process', 'check_if_cpf_cnpj_exists'); | |
function check_if_cpf_cnpj_exists() { | |
if( isset( $_POST['billing_cpf'] ) ){ |
This file contains hidden or 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 | |
/** | |
* Change permalink structure of the post_type post | |
*/ | |
add_filter('pre_post_link', 'filter_post_link', 10, 2); | |
function filter_post_link($permalink, $post) { | |
if ($post->post_type != 'post') | |
return $permalink; | |
return 'blog'.$permalink; | |
} |
This file contains hidden or 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 | |
function featured_image_rss($content) { | |
global $post; | |
if ( has_post_thumbnail( $post->ID ) ){ | |
$content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail', array( 'style' => 'float:left; margin:0 15px 15px 0;' ) ) . '' . $content; | |
} | |
return $content; | |
} | |
add_filter('the_excerpt_rss', 'featured_image_rss'); |
This file contains hidden or 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 | |
/* | |
* Woocommerce send email to customer when order status is change to Failed | |
*/ | |
add_action( 'woocommerce_order_status_failed', 'mysite_failed'); | |
function mysite_failed($order_id) { | |
error_log("$order_id set to FAILED", 0); | |
$order = wc_get_order( $order_id ); |
This file contains hidden or 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 | |
if ( function_exists( 'add_image_size' ) ) { | |
add_image_size( 'blog-thumb', 400, 9999 ); // 400px de largura máxima (e altura ilimitada) | |
add_image_size( 'main-thumb', 300, 250, true ); // corte/crop | |
} | |
?> |
This file contains hidden or 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
define( 'DISALLOW_FILE_EDIT', true ); |
This file contains hidden or 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
function gwp_remove_version() { | |
return ''; | |
} | |
add_filter('the_generator', 'gwp_remove_version'); |
This file contains hidden or 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
// Source: https://br.wordpress.org/support/topic/woocommerce-alterar-o-valor-do-pedido-apos-o-pagamento/ | |
add_filter( 'woocommerce_pagseguro_payment_xml', function( $xml, $order ) { | |
$newxml = $xml; | |
if($newxml->method == 'boleto'){ | |
$total = $order->total; | |
$discount_value = $total * 0.1; | |
$boleto_cost = 1; |
This file contains hidden or 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
/Applications/MAMP/Library/bin/mysql -uroot -p data_base_name < /Applications/MAMP/htdocs/path/dat_base_.sql |
This file contains hidden or 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 | |
$xml = new SimpleXMLElement('<xml/>'); | |
for ($i = 1; $i <= 8; ++$i) { | |
$track = $xml->addChild('track'); | |
$track->addChild('path', "song$i.mp3"); | |
$track->addChild('title', "Track $i - Track Title"); | |
} |
NewerOlder