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
<?php | |
/** | |
* @snippet Comprobar si el post tiene asignado el término "action" de la taxonomía "hook-type" | |
* para asignar una clase css u otra. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/comprobar-si-un-post-tiene-asignado-un-termino-de-una-taxonomia-en-wordpress/ | |
*/ | |
$hook_css_class = ''; |
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
<?php | |
/** | |
* @snippet Obtener el contenido de cualquier post en WordPress para mostrarlo por código | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/obtener-el-contenido-de-cualquier-post-en-wordpress/ | |
*/ | |
$page_shortcodes_postid = get_post( 2607 ); // obtenemos el post con ese 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
<?php | |
/** | |
* @hook woocommerce_account_content | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/hooks/woocommerce_account_content/ | |
* @description Añadir contenido a "Mi cuenta" en WooCommerce. | |
*/ | |
// Definir la función que realizará las acciones que queramos que se lleven a cabo |
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
<?php | |
/** | |
* @hook woocommerce_account_dashboard | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/hooks-woocommerce_account_dashboard/ | |
* @description Añadir contenido en la pestaña "Escritorio" de "Mi cuenta" en WooCommerce. | |
*/ | |
// Definir la función que realizará las acciones que queramos que se lleven a cabo |
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
<?php | |
/** | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/convertir-el-campo-de-codigo-postal-de-woocommerce-en-un-select-o-lista-deplegable/ | |
* @description Convertir el campo de código postal del checkout de WooCommerce en un campo tipo select con los códigos postable válidos. | |
*/ | |
add_filter( 'woocommerce_default_address_fields' , 'customize_postcode_fields' ); | |
function customize_postcode_fields( $adresses_fields ) { |
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
<?php | |
/** | |
* @snippet Redireccionar productos externos de WooCommerce a la url del producto y abrir en otra pestaña. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/redireccionar-directamente-los-productos-externos-de-woocommerce-y-abrir-en-otra-pestana-del-navegador/ | |
*/ | |
add_action( 'woocommerce_before_shop_loop_item', 'mycode_woocommerce_template_loop_product_link_open', 20 ); | |
function mycode_woocommerce_template_loop_product_link_open() { |
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
<?php | |
/** | |
* @snippet Habilitar opción en prodcutos para deshabilitar el uso de cupones en ese producto. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/excluir-productos-de-cualquier-cupon-creado-en-woocommerce/ | |
*/ | |
// Create and display the custom field in product general setting tab | |
add_action( 'woocommerce_product_options_general_product_data', 'add_custom_field_general_product_fields' ); | |
function add_custom_field_general_product_fields(){ |
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
<?php | |
/** | |
* @snippet Crear una nueva pentaña en la página de producto de WooCommerce | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/crear-una-nueva-pestana-en-la-pagina-de-producto-de-woocommerce/ | |
*/ | |
add_filter( 'woocommerce_product_tabs', 'oaf_nueva_petania_producto' ); |
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
<?php | |
/** | |
* @snippet Forzar el uso de cupones en WooCommerce | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/exigir-el-uso-de-cupones-en-woocommerce/ | |
*/ | |
add_action( 'woocommerce_check_cart_items', 'mandatory_coupon_code' ); | |
function mandatory_coupon_code() { |
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
<?php | |
/** | |
* @snippet Modificar traduccion cualquier texto en WordPress | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/como-traducir-cualquier-texto-en-wordpress/ | |
*/ | |
add_filter( 'gettext', 'traducir_cualquier_texto', 10, 3 ); |
OlderNewer