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
| #!/bin/bash | |
| # Script para personalizar el boilerplate de plugin de WordPress | |
| # Autor: F.GR Web | |
| # Versión: 1.0.0 | |
| set -e | |
| # Colores para output | |
| RED='\033[0;31m' |
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
| /** | |
| * We need to add the data to the CF7 field shortcode. | |
| * This example is with a data called 'datos-categorias'. | |
| * The shortcode in CF7 will be something like | |
| * [checkbox product-categories use_label_element data:datos-categorias] | |
| */ | |
| add_filter( 'wpcf7_form_tag_data_option', 'fgrweb_populate_cf7', 10, 3 ); | |
| /** |
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
| INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) | |
| VALUES ('newuserid', MD5('pass123'), 'First Name Last Name', 'email@email.com', '0'); | |
| INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) | |
| VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}'); | |
| INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) | |
| VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10'); |
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
| DELETE FROM wp_woocommerce_order_itemmeta; | |
| DELETE FROM wp_woocommerce_order_items; | |
| DELETE FROM wp_comments WHERE comment_type = 'order_note'; | |
| DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'shop_order' ); | |
| DELETE FROM wp_posts WHERE post_type = 'shop_order'; |
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
| tar -zcvf wp-content.tar.gz --exclude="wp-content/uploads" wp-content/ |
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
| function stripslashes_deep( $value ) { | |
| $value = is_array( $value ) ? array_map( 'stripslashes_deep', $value ) : stripslashes( $value ); | |
| return $value; | |
| } | |
| function fgr_grabar_meta( $post_id, $array_data ) { | |
| $new_data = maybe_serialize( stripslashes_deep( $array_sata ) ); | |
| update_post_meta( $post_id, 'fgr_meta', $new_data ); | |
| } |
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
| add_filter( 'woocommerce_available_payment_gateways', 'fgr_desactivar_metodos_de_pago' ); | |
| function fgr_desactivar_metodos_de_pago( $available_gateways ) { | |
| if ( ! is_checkout() ) return $available_gateways; | |
| $unset = false; | |
| $items = WC()->cart->get_cart(); | |
| foreach ( $items as $item => $values ) { | |
| $producto = $values['data']; | |
| $attribute = $producto->get_attribute('pa_atributo'); | |
| if ( 'Mi atributo' === $attribute ) { |
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
| RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$ | |
| RewriteRule ^(.*)$ https://sitioproduccion.com/$1 [QSA,L] | |
| # Para entornos NGINX me ha funcionado poner lo siguiente en la configuración | |
| location ~* ^.+\.(svg|svgz|jpg|jpeg|gif|png|ico|bmp|pdf)$ { | |
| try_files $uri @image_fallback; | |
| } | |
| location @image_fallback { |
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
| $curl = curl_init(); | |
| curl_setopt_array( | |
| $curl, | |
| array( | |
| CURLOPT_URL => "https://example.com/wp-json/wp/v2/evento?fields=id,title,modified_gmt,validate,status,from,until,location,web&per_page=20", | |
| CURLOPT_RETURNTRANSFER => true, | |
| CURLINFO_HEADER_OUT => true, | |
| CURLOPT_ENCODING => "", | |
| CURLOPT_MAXREDIRS => 10, |
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
| global $wpdb; | |
| $table_name = $wpdb->prefix . 'prueba_tabla'; | |
| $wpdb_collate = $wpdb->collate; | |
| $sql = | |
| "CREATE TABLE {$table_name} ( | |
| id mediumint(8) unsigned NOT NULL auto_increment , | |
| nombre varchar(255) NULL, | |
| PRIMARY KEY (id), | |
| KEY first (nombre) | |
| ) |
NewerOlder