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
/* Force email lowercase on WordPress registration | |
------------------------------------------------------------------ */ | |
function filter_pre_user_email( $raw_user_email ) { | |
$raw_user_email = strtolower($raw_user_email); | |
return $raw_user_email; | |
}; | |
// add the filter |
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 agregar_cpts_en_loop($query) { | |
if ($query->is_feed() || $query->is_main_query() && $query->is_front_page()) { | |
$query->set('post_type', array('post', 'YOUR_POST_TYPE')); | |
} | |
} | |
add_action('pre_get_posts', 'agregar_cpts_en_loop'); |
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 pw_send_subscription_cancelled_to_admin( $sub_id, $subscription ) { | |
$email_to = '[email protected]'; | |
$subject = 'Subscription Cancelled'; | |
$message = 'Subscription cancelled for ' $subscription->customer->email; | |
EDD()->emails->send( $email_to, $subject, $message ); | |
} | |
add_action( 'edd_subscription_cancelled', 'pw_send_subscription_cancelled_to_admin', 10, 2 ); | |
function pw_send_subscription_failed_to_admin( $subscription ) { | |
$email_to = '[email protected]'; |
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
add_filter('locale', 'jb_setLocale'); | |
function jb_setLocale($locale) { | |
if ( is_admin() ) { | |
return 'en_US'; | |
} | |
return $locale; | |
} |
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
// Añadir valor en píxel conversión Facebook con WooCommerce | |
add_action( 'woocommerce_thankyou', 'jb_pixeltracking' ); | |
function jb_pixeltracking( $order_id ) { | |
$order = new WC_Order( $order_id ); | |
$order_total = $order->get_total(); | |
?> | |
<!-- Nuevo pixel de Facebook, acción conversión dinámica --> | |
<script> | |
fbq('track', 'Purchase', {value: '<?php echo $order_total ?>', currency: 'EUR'}); |
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
add_action( 'woocommerce_checkout_process', 'jb_minimum_order_amount' ); | |
function jb_minimum_order_amount() { | |
global $woocommerce; | |
$minimum = 50; | |
if ( $woocommerce->cart->get_cart_total(); < $minimum ) { | |
$woocommerce->add_error( sprintf( 'Como mínimo necesitas comprar por valor de %s para procesar la compra.' , $minimum ) ); | |
} | |
} |
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
/** | |
* Register and enqueue Google Fonts (the right way) | |
*/ | |
function jb_google_fonts() { | |
// register styles | |
wp_register_style('googlefont-oswald', 'http://fonts.googleapis.com/css?family=Oswald:400,300,700', array(), false, 'all'); | |
// enqueue styles |
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
// Negar acceso al backoffice de los suscriptores | |
function jbl_redirect_admin(){ | |
if ( ! current_user_can( 'edit_posts' ) ){ | |
wp_redirect( site_url() ); | |
exit; | |
} | |
} | |
add_action( 'admin_init', 'jbl_redirect_admin' ); |