Skip to content

Instantly share code, notes, and snippets.

@simplistik
simplistik / gist:2001897
Created March 8, 2012 16:22
htaccess: Force PDF download
<FilesMatch "\.(?i:pdf)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012 18:32
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@Zodiac1978
Zodiac1978 / .htaccess
Last active June 10, 2024 18:57
Make your Website faster - a safe htaccess way
#
# Sources:
# http://stackoverflow.com/questions/7704624/how-can-i-use-gzip-compression-for-css-and-js-files-on-my-websites
# http://codex.wordpress.org/Output_Compression
# http://www.perun.net/2009/06/06/wordpress-websites-beschleuinigen-4-ein-zwischenergebnis/#comment-61086
# http://www.smashingmagazine.com/smashing-book-1/performance-optimization-for-websites-part-2-of-2/
# http://gtmetrix.com/configure-entity-tags-etags.html
# http://de.slideshare.net/walterebert/die-htaccessrichtignutzenwchh2014
# http://de.slideshare.net/walterebert/mehr-performance-fr-wordpress
# https://andreashecht-blog.de/4183/
@kloon
kloon / functions.php
Last active March 4, 2024 19:36
WooCommerce total order weight column on orders page
<?php
add_filter( 'manage_edit-shop_order_columns', 'woo_order_weight_column' );
function woo_order_weight_column( $columns ) {
$columns['total_weight'] = __( 'Weight', 'woocommerce' );
return $columns;
}
add_action( 'manage_shop_order_posts_custom_column', 'woo_custom_order_weight_column', 2 );
function woo_custom_order_weight_column( $column ) {
global $post, $woocommerce, $the_order;
@DevinWalker
DevinWalker / woocommerce-optimize-scripts.php
Last active June 21, 2024 22:52
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@kittenlane
kittenlane / 1-remove-woocommerce-tabs.php
Last active November 30, 2023 20:07
Remove tabs but keep product description in WooCommerce
//* http://gasolicious.com/remove-tabs-keep-product-description-woocommerce/
// Location: add to functions.php
// Output: removes woocommerce tabs
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
@wy4tt34rp
wy4tt34rp / WooCommerce Filter Adding Captions to Gallery Thumbnails
Last active October 26, 2021 14:43
WooCommerce Filter Adding Captions to Gallery Thumbnails
<?php
/*
Plugin Name: Limit Cart Weight to increments
Plugin URI: https://www.damiencarbery.com/
Description: Prevent checkout unless cart is above a minimum weight and increments of a weight.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
@EmadAdly
EmadAdly / SSL-renewal.md
Last active June 11, 2024 10:48
Renew The Let’s Encrypt Certificate in bitnami

Renew The Let’s Encrypt Certificate

Let’s Encrypt certificates are only valid for 90 days. To renew the certificate before it expires, run the following commands from the server console as the bitnami user. Remember to replace the DOMAIN placeholder with your actual domain name, and the EMAIL-ADDRESS placeholder with your email address.

1- Login your server using SSH

ssh -i Key.pem bitnami@00.00.00.00

2- Stop Apache Server

sudo /opt/bitnami/ctlscript.sh stop

@someguy9
someguy9 / disable-wordpress-admin-new-user-notification.php
Created May 14, 2020 19:05
Disable the WordPress new user email notification sent to the site admin
<?php
//Disable the new user notification sent to the site admin
function smartwp_disable_new_user_notifications() {
//Remove original use created emails
remove_action( 'register_new_user', 'wp_send_new_user_notifications' );
remove_action( 'edit_user_created_user', 'wp_send_new_user_notifications', 10, 2 );
//Add new function to take over email creation
add_action( 'register_new_user', 'smartwp_send_new_user_notifications' );
add_action( 'edit_user_created_user', 'smartwp_send_new_user_notifications', 10, 2 );