Skip to content

Instantly share code, notes, and snippets.

View OscarAbadFolgueira's full-sized avatar

Oscar Abad Folgueira OscarAbadFolgueira

View GitHub Profile
@OscarAbadFolgueira
OscarAbadFolgueira / oaf_wc_exclude_categories_from_list.php
Created March 7, 2016 20:51
WooCommerce Snippet: Excluir categorías de la lista de categorías
<?php
/**
* This WooCommerce code snippet enables to exclude some categories from the categories list widget.
*
* Author: Oscar Abad Folgueira
* Author URI: http://www.oscarabadfolgueira.com
*
* You can copy this snippet and paste in your functions.php or you can build your own plugin
*
* Change the category ids to your needs.
@OscarAbadFolgueira
OscarAbadFolgueira / oaf_change_paypal_icon_image.php
Created March 11, 2016 20:02
This WooCommerce code snippet enables you to change de paypal icon-image on checkout page
<?php
/**
* This WooCommerce code snippet enables you to change de paypal icon-image on checkout page.
*
* Author: Oscar Abad Folgueira
* Author URI: http://www.oscarabadfolgueira.com
*
* You can copy this snippet and paste in your functions.php or you can build your own plugin
*
* Change the image for other you want.
@OscarAbadFolgueira
OscarAbadFolgueira / oaf-wp-reemplazar-hola.php
Last active March 15, 2016 16:21
WordPress Snippet que cambia la palabra "Hola" de saludo al usuario logueado.
<?php
/**
* Este WordPress Snippet cambia la palabra "Hola" de saludo al usuario logueado. Parte superior derecha de la pantalla.
*
* Author: Oscar Abad Folgueira
* Author URI: http://www.oscarabadfolgueira.com
*
* You can copy this snippet and paste in your functions.php or you can build your own plugin
*
* Change the text to replace to your needs.
@OscarAbadFolgueira
OscarAbadFolgueira / oaf-restrict-partial-content-shortcode.php
Created March 15, 2016 17:27
creates a [restrict_pcs] that you can use to restrict some contents of your posts or pages
<?php
/*
Plugin Name: OAF Restrict Partial Content Shortcode
Plugin URI: https://www.oscarabadfolgueira.com
Description: This plugin creates a [restrict_pcs] that you can use to restrict some contents of your posts or pages.
Version: 1.0
Author: Oscar Abad Folgueira
Author URI: https://www.oscarabadfolgueira.com
License: GPLv2 only
License URI: http://www.gnu.org/licenses/gpl-2.0.html
<?php
/*
* Plugin Name: OAF Restrict Partial Content Shortcode
* Plugin URI: https://www.oscarabadfolgueira.com/crear-shortcode-restringir-partes-del-contenido
* Description: This plugin creates a [restrict_pcs] that you can use to restrict some contents of your posts or pages.
* Version: 1.2
* Author: Oscar Abad Folgueira
* Author URI: https://www.oscarabadfolgueira.com
* License: GPLv2 only
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@OscarAbadFolgueira
OscarAbadFolgueira / wp_dinapyme_personalizar_colores_mce
Created June 29, 2016 21:19
Snippet para WordPress que permite modificar los colores de texto del editor de WordPress añadiendo los nuestros personalizados.
function wp_dinapyme_personalizar_colores_mce( $opciones ) {
// el array $colores_base contiene los colores estándar del editor de WordPress
$colores_base = '
"000000", "Negro",
"993300", "Burnt orange",
"333300", "Dark olive",
"003300", "Dark green",
"003366", "Dark azure",
"000080", "Navy Blue",
@OscarAbadFolgueira
OscarAbadFolgueira / wp_dinapyme_personalizar_colores_mce-mis_colores
Created June 29, 2016 21:34
Parte de $mis colores del snippet wp_dinapyme_personalizar_colores_mce
$mis_colores = '
"403075", "Dinapyme Color 1",
"408E2F", "Dinapyme Color 2",
"AA6B39", "Dinapyme Color 3"
';
@OscarAbadFolgueira
OscarAbadFolgueira / dinapyme-woocommerce-excluir-categoria-del-widget.php
Last active September 17, 2019 17:21
WooCommerce Snippet para excluir categorías del widget de categorías de productos
add_filter( 'woocommerce_product_categories_widget_args', 'dinapyme_woocommerce_excluir_categoria_del_widget' );
// Creación de la función que añade los IDs de las categorías al array de argumentos
function dinapyme_woocommerce_excluir_categoria_del_widget( $argumentos_widget ) {
$argumentos_widget['exclude'] = array('12','10'); //añadirmos las IDs de las categorías
return $argumentos_widget;
}
@OscarAbadFolgueira
OscarAbadFolgueira / dinapyme-woocommerce-modificar-texto-oferta.php
Created July 7, 2016 12:42
Snippet para WooCommerce que modifica el texto de "Oferta" en los productos rebajados
add_filter( 'woocommerce_sale_flash', 'dinapyme_wc_modificar_texto_oferta' );
function dinapyme_wc_modificar_texto_oferta( $texto ) {
//cabia el valor del texto original 'Sale!' de WooCommerce por el texto '¡Promoción!'
return str_replace( __( 'Sale!', 'woocommerce' ), __( '¡Promoción!', 'woocommerce' ), $texto );
}
@OscarAbadFolgueira
OscarAbadFolgueira / cabecera-plugin-wordpress.php
Created September 22, 2016 17:53
Ejemplo de fichero con cabecera para plugin de WordPress
<?php
/**
* Plugin Name: Mi primer plugin
* Plugin URI: http://www.dinapyme.com/podcast/42-introduccion-al-desarrollo-de-plugins-para-wordpress/
* Description: Plugin de ejemplo para saber como crear un plugin
* Version: 0.1
* Author: Oscar Abad Folgueira
* Author URI: https://www.dinapyme.com
* Text Domain: dinapyme-ejemplo
* Domain Path: /languages/