This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// place this in your child theme functions.php file to remove related products from WooCommerce | |
// posted by Robin Scott of Silicon Dales, here: https://silicondales.com/tutorials/woocommerce/remove-related-products-woocommerce/ | |
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Below declares woocommerce support when added to a theme or child theme functions.php - from the official WooCommerce Github (August 2018) | |
// Posted by Robin Scott of Silicon Dales here https://silicondales.com/tutorials/woocommerce/declare-woocommerce-support-theme/ to benefit the Open Source community. Free to share and distribute for any purpose. | |
function mytheme_add_woocommerce_support() { | |
add_theme_support( 'woocommerce' ); | |
} | |
add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Originally posted in official WooCommerce Github | |
// Re-posted by Robin Scott of Silicon Dales here https://silicondales.com/tutorials/woocommerce/declare-woocommerce-support-theme/ to aid understanding and benefit all in the Open Source community. Feel free to share are distribute as required! | |
function mytheme_add_woocommerce_support() { | |
add_theme_support( 'woocommerce', array( | |
'thumbnail_image_width' => 150, | |
'single_image_width' => 300, | |
'product_grid' => array( | |
'default_rows' => 3, | |
'min_rows' => 2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this into your .htaccess file at the root of your WordPress installation. By Robin Scott of Silicon Dales. | |
// See full details here: https://silicondales.com/tutorials/wordpress/lock-out-all-traffic-except-your-ip-from-login-admin/ | |
<Files wp-login.php> | |
Order Deny,Allow | |
Deny from all | |
Allow from X.X.X.X | |
</Files> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this to an .htaccess file at the top of the wp-admin directory to lock down this section of your site to only trusted IP addresses | |
// By Robin Scott of Silicon Dales - details here: https://silicondales.com/tutorials/wordpress/lock-out-all-traffic-except-your-ip-from-login-admin/ | |
Order Deny,Allow | |
Deny from all | |
Allow from X.X.X.X |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this to an .htaccess file at the top of the wp-admin directory to lock down this section of your site to only trusted IP addresses - BUT still allow ajax access | |
// By Robin Scott of Silicon Dales - details here: https://silicondales.com/tutorials/wordpress/lock-out-all-traffic-except-your-ip-from-login-admin/ | |
<Files admin-ajax.php> | |
Order allow,deny | |
Allow from all | |
Satisfy any | |
</Files> | |
Order Deny,Allow | |
Deny from all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// By Robin Scott of Silicon Dales | |
// Add 6oz extra weight to all cart items in specific shipping class | |
// More information here: https://silicondales.com/tutorials/woocommerce/add-additional-shipping-weight-to-cart-items-in-a-shipping-class/ | |
add_action( 'woocommerce_before_calculate_totals', 'rscott_add_custom_weight', 10, 1); | |
function rscott_add_custom_weight( $cart_object ) { | |
if ( (is_admin() && ! defined( 'DOING_AJAX' ) ) || $cart_object->is_empty() ) | |
return; | |
if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 ) | |
return; | |
$additionalweight = 6; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Order Deny,Allow | |
Deny from 222.222.222.222 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## EXPIRES CACHING - by Robin Scott of Silicon Dales, here https://silicondales.com/tutorials/seo/leverage-browser-caching-images-css-js/## | |
ExpiresActive On | |
ExpiresByType image/jpg "access 1 year" | |
ExpiresByType image/jpeg "access 1 year" | |
ExpiresByType image/gif "access 1 year" | |
ExpiresByType image/png "access 1 year" | |
ExpiresByType text/css "access 1 month" | |
ExpiresByType application/pdf "access 1 month" | |
ExpiresByType application/javascript "access 1 month" | |
ExpiresByType application/x-javascript "access 1 month" |