Skip to content

Instantly share code, notes, and snippets.

Tuan Phan tuanbbhero

View GitHub Profile
@tuanbbhero
tuanbbhero / mediaqueries.css
Created Nov 12, 2019 — forked from needim/mediaqueries.css
Device Specific CSS Media Queries Collection
View mediaqueries.css
/*
Based on:
1. http://stephen.io/mediaqueries
2. https://css-tricks.com/snippets/css/media-queries-for-standard-devices/
*/
/* iPhone X in portrait & landscape */
@media only screen
and (min-device-width : 375px)
and (max-device-width : 812px)
View Add Checkbox to Checkout Page WooCommerce
add_action( 'woocommerce_review_order_before_submit', 'bbloomer_add_checkout_privacy_policy', 9 );
function bbloomer_add_checkout_privacy_policy() {
woocommerce_form_field( 'privacy_policy', array(
'type' => 'checkbox',
'class' => array('form-row privacy'),
'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'),
'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'),
'required' => true,
@tuanbbhero
tuanbbhero / media-query.css
Created May 14, 2019 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
View media-query.css
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
View Enable GZIP - Apache
/* Add to below # END WordPress in htaccess */
<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
View Add Admin Account in Functions
function wpb_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = 'email@domain.com';
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
} }
add_action('init','wpb_admin_account');
View Fix Leverage Browser Caching
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|svg|js|css|swf)$">
Header set Cache-Control "max-age=84600, public"
</filesMatch>
## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/webp "access 1 year"
ExpiresByType image/jpeg "access 1 year"
View Remove Query Strings
function remove_query_strings() {
if(!is_admin()) {
add_filter('script_loader_src', 'remove_query_strings_split', 15);
add_filter('style_loader_src', 'remove_query_strings_split', 15);
}
}
function remove_query_strings_split($src){
$output = preg_split("/(&ver|\?ver)/", $src);
return $output[0];
View Leverage Browser Caching
// Cache-Control
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|svg|js|css|swf)$">
Header set Cache-Control "max-age=84600, public"
</filesMatch>
// Expires Header
## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
@tuanbbhero
tuanbbhero / Full-height fixed row on Right - Beaver Builder
Last active Apr 12, 2019
Full-height sticky row on right and left, created by BeaverHero.com
View Full-height fixed row on Right - Beaver Builder
/* If you want to sticky on RIGHT, use this css */
@media screen and (min-width:991px) {
.kl-fixed-sidebar {
position: fixed;
top:0;
bottom:0;
right:0;
height:100%;
z-index:9000;
width: 250px;
View Change Copyright Text - GP Premium
You can’t perform that action at this time.