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
/*Aviso bajo imagen en pdto único*/ | |
add_action( 'woocommerce_after_single_product_summary' , 'bbloomer_add_below_prod_gallery', 5 ); | |
function bbloomer_add_below_prod_gallery() { | |
echo '<div class="woocommerce-product-gallery" style="background: #51559f; padding: 1em 2em; color: #ffffff;">'; | |
echo '<span>Todas las descargas equivalen a 1 crédito, <b><a href="https://pruebas.marceloglez.com">elije tu plan</a>.</span></b>'; | |
echo '</div>'; | |
} |
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
/* Enviar directamente al pago */ | |
add_filter ('add_to_cart_redirect', 'redirect_to_checkout'); | |
function redirect_to_checkout() { | |
global $woocommerce; | |
$checkout_url = $woocommerce->cart->get_checkout_url(); | |
return $checkout_url; | |
} |
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
// NUEVO SHORTCODE PARA REGISTRO: [wc_reg_form_bbloomer] | |
add_shortcode( 'wc_reg_form_bbloomer', 'bbloomer_separate_registration_form' ); | |
function bbloomer_separate_registration_form() { | |
if ( is_admin() ) return; | |
if ( is_user_logged_in() ) return; | |
ob_start(); | |
// NOTE: THE FOLLOWING <FORM></FORM> IS COPIED FROM woocommerce\templates\myaccount\form-login.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
/*OPCIÓN 1: Primero activar checkbox "Redirigir a la página del carrito tras añadir productos con éxito"*/ | |
function cod_redirect_checkout_add_cart( $url ) { | |
$url = wc_get_page_permalink( 'checkout' ); | |
return $url; | |
} | |
add_filter( 'woocommerce_add_to_cart_redirect', 'cod_redirect_checkout_add_cart' ); | |
/*OPCIÓN 2*/ | |
/* Enviar directamente al pago */ |
NewerOlder