Skip to content

Instantly share code, notes, and snippets.


Andrei Chira fasterwp

View GitHub Profile
fasterwp / replace-urls
Created Jun 11, 2018
Replace old domain with new domain in database
View replace-urls
UPDATE wp_options SET option_value = REPLACE(option_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_posts SET guid = REPLACE(guid, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'ORIGINAL_URL', 'NEW_URL');
fasterwp / redirect-domain
Created Jun 11, 2018
Redirect old domain to new domain in htaccess
View redirect-domain
RewriteEngine on
RewriteCond %{HTTP_HOST} ^ [NC,OR]
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301,NC]
fasterwp / HTTPS-redirect
Created Jun 12, 2018
Redirect to HTTPS with Let's Encrypt exception
View HTTPS-redirect
RewriteEngine On
RewriteRule ^.well-known - [L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
fasterwp / cabral-css-example
Created Jun 12, 2018
CSS example, different background colors for menu items
View cabral-css-example
.cbr-meniu-1 {background-color: #85ae52;}
.cbr-meniu-2 {background-color: #84d48d;}
.cbr-meniu-3 {background-color: #665a98;}
fasterwp / genesis-google-fonts
Created Jun 12, 2018
The default code from Genesis to load Google fonts
View genesis-google-fonts
wp_enqueue_style( 'google-font', '//,700|Roboto+Slab:300', array(), PARENT_THEME_VERSION );
fasterwp / google-font-example
Created Jun 12, 2018
Example of Google fonts loaded in Genesis child theme
View google-font-example
wp_enqueue_style( 'google-font', '//,700|Playfair+Display', array(), PARENT_THEME_VERSION );
fasterwp / font-CSS-example
Created Jun 12, 2018
Example to change fonts from style.css
View font-CSS-example
.entry-title {
font-size: 36px;
font-size: 3.6rem;
line-height: 1;
font-family: Playfair Display, Georgia, serif;
font-weight: 400;
fasterwp / latin-ext-font-example
Created Jun 12, 2018
Example to load fonts with latin extended characters
View latin-ext-font-example
wp_enqueue_style( 'source-font', '//,700&subset=latin-ext', array(), PARENT_THEME_VERSION );
wp_enqueue_style( 'playfair-font', '//', array(), PARENT_THEME_VERSION );
fasterwp / register-widgets-genesis
Created Jun 12, 2018
Register a home widget in Genesis and unregister unused areas and layouts
View register-widgets-genesis
//* Unregister widgets areas & layouts
unregister_sidebar( 'sidebar-alt' );
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
//* Register Home Slider widget area
genesis_register_sidebar( array(
'id' => 'home-slider',
fasterwp / remove-transients
Created Jun 25, 2018
mysql query to remove WordPress transients from wp_options table
View remove-transients
DELETE FROM `wp_options` WHERE `option_name` LIKE ('%\_transient\_%');