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
/* 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 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
/*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 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
// 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 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
/** | |
* 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 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
/*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 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
/*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 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
/*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 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
/* Checkbox habilitado crear cuenta en checkout */ | |
add_filter('woocommerce_create_account_default_checked' , function ($checked){ | |
return 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
/*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 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
/*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