View incluir-acf-en-plugin.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
<?php | |
/** | |
* @snippet WordPress Snippet: Incluir ACF en un plugin | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/ | |
*/ | |
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
View oaf-wp-change-translated-texts.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
<?php | |
/** | |
* @snippet WordPress Snippet: Cambiar traducción de textos | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/ | |
*/ | |
// Cambiar la traducción del texto "Nombre de usuario o correo electrónico" del formulario de acceso | |
add_filter( 'gettext', 'oaf_change_traduction_text', 10, 3 ); |
View oaf-wp-disable-email-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
<?php | |
/** | |
* @snippet WordPress Snippet: Desactivar login por email | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/ | |
*/ | |
// Desactivar login por email | |
remove_filter( 'authenticate', 'wp_authenticate_email_password', 20 ); |
View oaf-check-woo-active.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
<?php | |
/** | |
* @snippet WooCommerce Snippet: Comprobar si WooCommerce está activado. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/woocommerce-snippet-comprobar-si-woocommerce-esta-activado/ | |
*/ | |
// Comprobar si WooCommerce está en el array de plugins ativos | |
if ( in_array( |
View oaf-check-woo-installed.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
<?php | |
/** | |
* @snippet WooCommerce Snippet: Comprobar si WooCommerce está instalado. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/woocommerce-snippet-comprobar-si-woocommerce-esta-instalado/ | |
*/ | |
if ( class_exists( 'WooCommerce' ) ) { | |
echo "WooCommerce está instalado. Podemos seguir"; |
View oaf-php-get-keys-associative-array.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
<?php | |
/** | |
* @snippet PHP Snippet: Obtener sólo las claves de un array asociativo en otro array. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com | |
*/ | |
$array = array("1" => "Uno", "2" => "Dos", "3" => "Tres", "4" => "Cuatro"); | |
print_r(array_keys($array)); |
View oaf-php-get-values-associative-array.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
<?php | |
/** | |
* @snippet PHP Snippet: Obtener sólo los valores de un array asociativo en otro array. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com | |
*/ | |
$array = array("1" => "Uno", "2" => "Dos", "3" => "Tres", "4" => "Cuatro"); | |
print_r(array_values($array)); |
View oaf-acf-get-object-settings.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
<?php | |
/** | |
* @snippet ACF Snippet: Obtener los ajustes de un campo de ACF. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com | |
*/ | |
$campo = get_field_object( 'field_6124b36041b98' ); |
View oaf-set-jwt-token-expiration.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
<?php | |
/** | |
* @snippet WordPress Snippet: Establecer tiempo de expiracion del token de "JWT Authentication for WP REST API". | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/establecer-el-tiempo-de-expiracion-del-token-de-la-rest-api-de-wordpress/ | |
*/ | |
// Establecer el tiempo a una hora (3600 segundos). |
View wp-remove-all-endpoints.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
<?php | |
/** | |
* @snippet WordPress Snippet: Deshabilitar todos los endpoints de la rest api. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/ | |
*/ | |
add_filter( 'rest_endpoints', 'oaf_remove_default_endpoints' ); | |
NewerOlder