Skip to content

Instantly share code, notes, and snippets.

View fasterwp's full-sized avatar
🏠
Working from home

Andrei Chira fasterwp

🏠
Working from home
View GitHub Profile
@fasterwp
fasterwp / post-revisions
Created June 25, 2018 08:57
set post revions in wp-config.php
define( 'WP_POST_REVISIONS', 3 );
@fasterwp
fasterwp / remove-transients
Created June 25, 2018 08:56
mysql query to remove WordPress transients from wp_options table
DELETE FROM `wp_options` WHERE `option_name` LIKE ('%\_transient\_%');
@fasterwp
fasterwp / register-widgets-genesis
Created June 12, 2018 06:36
Register a home widget in Genesis and unregister unused areas and layouts
//* 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
fasterwp / latin-ext-font-example
Created June 12, 2018 06:30
Example to load fonts with latin extended characters
wp_enqueue_style( 'source-font', '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,700&subset=latin-ext', array(), PARENT_THEME_VERSION );
wp_enqueue_style( 'playfair-font', '//fonts.googleapis.com/css?family=Playfair+Display&subset=latin-ext', array(), PARENT_THEME_VERSION );
@fasterwp
fasterwp / font-CSS-example
Created June 12, 2018 06:24
Example to change fonts from style.css
.entry-title {
font-size: 36px;
font-size: 3.6rem;
line-height: 1;
font-family: Playfair Display, Georgia, serif;
font-weight: 400;
}
@fasterwp
fasterwp / google-font-example
Created June 12, 2018 06:22
Example of Google fonts loaded in Genesis child theme
wp_enqueue_style( 'google-font', '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Playfair+Display', array(), PARENT_THEME_VERSION );
@fasterwp
fasterwp / genesis-google-fonts
Created June 12, 2018 06:20
The default code from Genesis to load Google fonts
wp_enqueue_style( 'google-font', '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Roboto+Slab:300', array(), PARENT_THEME_VERSION );
@fasterwp
fasterwp / cabral-css-example
Created June 12, 2018 06:12
CSS example, different background colors for menu items
.cbr-meniu-1 {background-color: #85ae52;}
.cbr-meniu-2 {background-color: #84d48d;}
.cbr-meniu-3 {background-color: #665a98;}
@fasterwp
fasterwp / HTTPS-redirect
Created June 12, 2018 05:44
Redirect to HTTPS with Let's Encrypt exception
RewriteEngine On
RewriteRule ^.well-known - [L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
@fasterwp
fasterwp / redirect-domain
Created June 11, 2018 19:17
Redirect old domain to new domain in htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301,NC]