Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Clason steveclason

View GitHub Profile
@steveclason
steveclason / cloudSettings
Last active Mar 10, 2021
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2021-03-10T22:20:41.745Z","extensionVersion":"v3.4.3"}
@steveclason
steveclason / cart-shipping.php
Last active Sep 17, 2018
Woocommerce Enable/Disable Shipping Methods
View cart-shipping.php
<?php
/**
* Shipping Methods Display
*
* In 2.1 we show methods per package. This allows for multiple methods per order if so desired.
*
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-shipping.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
@steveclason
steveclason / functions.php
Created Jan 8, 2017
WordPress, defer loading of specific script(s).
View functions.php
// script_loader_tag is new as of WP 4.1
add_filter( 'script_loader_tag', function ( $tag, $handle ) {
if ( 'contact-form-7' !== $handle )
return $tag;
return str_replace( ' src', ' defer="defer" src', $tag );
}, 10, 2 );
View wp_print_active_plugins.php
<?php
/*
* Print a list of active WordPress Plugins.
* Put this in a template file you can see or hide it and use DevTools to view it.
* Useful for troubleshooting perfomance problems in sites with many plugins.
*/
// Check if get_plugins() function exists. This is required on the front end of the
// site, since it is in a file that is normally only loaded in the admin.
if ( ! function_exists( 'get_plugins' ) ) {
@steveclason
steveclason / aggregate_files.php
Created May 26, 2016
Override Header Layout in Avada Child Theme
View aggregate_files.php
<?php
/* Override (modify) the Avada header layouts in a child theme by establishing a local version. */
/* Avada has 6 header layouts selectable via Avada > Theme Options > Header > Header Content. These map to files at
"/wp-content/themes/Avada/templates". You can use your browser's devtools to look in the header for something like
'<div class="fusion-header-v1 ... ">' which will help identify what's being used, if you don't already know.
*/
// Copy this block from "/wp-content/themes/Avada/templates/header.php". If you are not using header_1 then copy the appropriate block.
if ( ! function_exists( 'avada_header_1' ) ) {