Skip to content

Instantly share code, notes, and snippets.

View spigotdesign's full-sized avatar

Bryan Hoffman spigotdesign

View GitHub Profile
@spigotdesign
spigotdesign / woo-checkout-change-default-country.php
Last active May 8, 2018 17:45
Change the default country for WooCommerce checkout shipping
/**
* Change the default country on the checkout page
*/
add_filter( 'default_checkout_billing_country', 'change_default_checkout_country' );
function change_default_checkout_country() {
return 'US'; // Put Country code here
}
@spigotdesign
spigotdesign / woo-checkout-change-default-state.php
Created May 8, 2018 17:05
Change default state on WooCommerce checkout state dropdown
/**
* Change the default state on the checkout page
*/
add_filter( 'default_checkout_billing_country', 'change_default_checkout_country' );
add_filter( 'default_checkout_billing_state', 'change_default_checkout_state' );
function change_default_checkout_state() {
return 'XX'; // state code
}
@spigotdesign
spigotdesign / wp-media-https.php
Last active May 7, 2018 14:59
Force WordPress Media button to insert https links
add_filter( ‘image_send_to_editor’, ‘force_protocol_relative’, 10, 9 );
function force_protocol_relative($content) {
$content = str_replace( ‘http://’, ‘https://’, $content );
return $content;
}
@spigotdesign
spigotdesign / remove-woo-product-gallery
Created May 2, 2018 19:20
Remove WooCommerce Product Gallery
@spigotdesign
spigotdesign / pre_get_posts-cpt.php
Last active January 24, 2018 22:02
Show all items on WordPress CPT archive
/**
* Show all Portfolio CPT items on archive
*
*/
add_action( 'pre_get_posts', 'spigot_show_all_work' );
function spigot_show_all_work( $query ) {
if ( ! is_admin() && $query->is_main_query() ) {
@spigotdesign
spigotdesign / wp_admin_user.sql
Last active November 9, 2017 18:27
Add an Admin user to WordPress through the database
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');
<section id="team" class="team pad-section narrow">
<h1 class="section-title"><?php the_field('t_title'); ?></h1>
<div class="contain">
<?php $tImage = get_field('t_image'); ?>
<?php echo wp_get_attachment_image($tImage, 'full'); ?>
<?php @header( 'HTTP/1.1 404 Not found', true, 404 );
get_header(); // Loads the header.php template. ?>
<main class="content" itemprop="mainContentOfPage">
<header class="page-header">
<h1 <?php hybrid_attr( 'entry-title' ); ?>><?php _e( '404 Error: Page Not Found', 'windsorone' ); ?></h1>
<?php
/**
* Template Name: Dealer Locator
*
* This is the template used for displaying the home page.
*
* @package windsorone
* @subpackage Template
*/
# Gzip compression
<IfModule mod_deflate.c>
# Active compression
SetOutputFilter DEFLATE
# Force deflate for mangled headers
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
# Don’t compress images and other uncompressible content