Skip to content

Instantly share code, notes, and snippets.

@alltrad3s
alltrad3s / Control de Cache Opcion 2.htaccess
Created October 10, 2016 05:11
Como optimizar WordPress con .htaccess
# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "max-age=604800, public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "max-age=216000, private"
@alltrad3s
alltrad3s / Control de Cache.htaccess
Created October 10, 2016 05:10
Como optimizar WordPress con .htaccess
# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
@alltrad3s
alltrad3s / Expirar Encabezados.htaccess
Created October 10, 2016 05:08
Como optimizar WordPress con .htaccess
#BEGIN EXPIRES HEADERS
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default expiration: 1 hour after request
ExpiresDefault "now plus 1 hour"
# CSS and JS expiration: 1 week after request
ExpiresByType text/css "now plus 1 week"
ExpiresByType application/javascript "now plus 1 week"
ExpiresByType application/x-javascript "now plus 1 week"
@alltrad3s
alltrad3s / GZIP.htaccess
Created October 10, 2016 05:06
Como optimizar WordPress con .htaccess
# BEGIN GZIP COMPRESSION
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
@alltrad3s
alltrad3s / DEFLATE.htaccess
Created October 10, 2016 05:04
Como optimizar WordPress con .htaccess
# BEGIN DEFLATE COMPRESSION
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
//Definir UTF-8 en wp-config
define('DB_CHARSET', 'utf-8');
//HTML5
<meta charset=”utf-8″ />
//HTML 4
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /> (HTML 4)
@alltrad3s
alltrad3s / woo-sku-functions.php
Created September 25, 2016 17:09
This is used to change the word SKU on WooCommerce
/*
Replace SKU on WooCommerce for Other word.
*/
add_filter('gettext', 'change_sku', 999, 3);
function change_sku( $translated_text, $text, $domain ) {
if( $text == 'SKU' || $text == 'SKU:' ) return 'CODE';
return $translated_text;
}
/**
* Embed Gists with a URL
*
* Usage:
* Paste a gist link into a blog post or page and it will be embedded eg:
* https://gist.github.com/2926827
*
* If a gist has multiple files you can select one using a url in the following format:
* https://gist.github.com/2926827?file=embed-gist.php
*