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
/* Muestra el total de posts de un CPT - reemplaza ('cpt'), usar shortcode: [cantidad_cpt] */ | |
function shortcode_total_cpt($atts) { | |
return wp_count_posts('cpt')->publish; | |
} | |
add_shortcode('cantidad_cpt', 'shortcode_total_cpt'); | |
/* Muestra el total de posts del blog genérico, usar shortcode [cantidad_post] */ | |
function shortcode_total_post($atts) { | |
return wp_count_posts('post')->publish; | |
} |
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
/*Crea un shortcode para mostrar el año en curso en cualquier lugar de la web en Wordpress, usar luego [year]*/ | |
function current_year_shortcode() { | |
$year = date('Y'); | |
return $year; | |
} | |
add_shortcode('year', 'current_year_shortcode'); |
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
// Nueva Exportación | |
// WP_Query Results | |
********** Consulta: | |
"post_type" => "attachment", | |
"post_status" => "inherit", | |
"post_mime_type" => array( "image/jpeg", "image/gif", "image/png", "image/bmp", "image/tiff", "image/x-icon", "audio/mpeg" ) | |
**********Campos de la plantilla de exportación: (Opcionales) | |
(Image ID) 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
/** | |
* Código al functions.php del child theme. | |
* Se podrá descargar archivos en cualquier formato desde una url externa en nuestro dominio. | |
* Para usarlo, por ejemplo definir enlaces así: | |
* https://tudominio.com/download?url=https://dominio-externo.com/archivo.mp3 | |
*/ | |
$url = $_GET['url']; | |
if ( ! empty( $url ) ) { | |
require_once ABSPATH . 'wp-load.php'; |
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
/*REDIRECCION DEL LOGOUT A LA HOME usando youpage.com/wp-login.php?action=logout*/ | |
/** | |
* Generates custom logout URL | |
*/ | |
function getLogoutUrl($redirectUrl = ''){ | |
if(!$redirectUrl) $redirectUrl = site_url(); | |
$return = str_replace("&", '&', wp_logout_url($redirectUrl)); | |
return $return; | |
} |
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
/*Oculta el campo ¿Tienes un cupon? en checkout*/ | |
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form'); | |
/*Muestra el campo ¿Tienes un cupon? en checkout*/ | |
add_action( 'woocommerce_after_checkout_form', 'woocommerce_checkout_coupon_form' ); |
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
/*Personalizar texto en checkout "tienes un cupon..."*/ | |
add_filter( 'woocommerce_checkout_coupon_message', 'bbloomer_have_coupon_message'); | |
function bbloomer_have_coupon_message() { | |
return '¿Tienes un cupón? 🍀 <a href="#" class="showcoupon">Introduce tu código aquí</a>'; | |
} |
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
/* Checkbox habilitado crear cuenta en checkout */ | |
add_filter('woocommerce_create_account_default_checked' , function ($checked){ | |
return 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
/*Elimina la dureza de la contrasena para nuevos usuarios*/ | |
add_action ('wp_print_scripts', function () { | |
if (wp_script_is ('wc-password-strength-meter', 'enqueued')) | |
wp_dequeue_script ('wc-password-strength-meter'); | |
}, 100); |
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
/*Ocultar otros metodos de envio cuando hay envio gratis*/ | |
add_filter( 'woocommerce_package_rates', 'bbloomer_unset_shipping_when_free_is_available_all_zones', 10, 2 ); | |
function bbloomer_unset_shipping_when_free_is_available_all_zones( $rates, $package ) { | |
$all_free_rates = array(); | |
foreach ( $rates as $rate_id => $rate ) { | |
if ( 'free_shipping' === $rate->method_id ) { | |
$all_free_rates[ $rate_id ] = $rate; |
NewerOlder