Skip to content

Instantly share code, notes, and snippets.

@khalidahmada
khalidahmada / wp-mailhog-config-smtp.php
Created August 10, 2018 11:14
Config Wordpress SMTP for MailHog - test your emails local
/*
* Add the MailHog to your wordpress projects
* By Khalid Ahmada
* MailHog @see https://github.com/mailhog/MailHog
*/
class WP_MAILHOG
{
function __construct()
@lynt-smitka
lynt-smitka / .htaccess
Last active August 12, 2024 09:18
Block hidden files except .well-known - Apache .htaccess + Nginx
RewriteRule "(^|/)\.(?!well-known\/)" - [F]
@hdytsgt
hdytsgt / woocommerce-checkout-apartmentno-field.php
Created July 19, 2018 06:59
Add apartment number field in checkout billing adress.
<?php
/**
* Plugin Name: WooCommerce Checkout Apartment No. Field
* Plugin URI: https://github.com/hdytsgt
* Description: Add apartment number field in checkout billing adress.
* Version: 1.0.0
* Author: Hidayat Sagita
* Author URI: https://github.com/hdytsgt
* Developer: Hidayat Sagita
* Developer URI: https://github.com/hdytsgt
# Disable Woocommerce cart fragments for homepage via .htaccess
# By creating empty response
# Please replace yoursite.com
# Disable only on homepage
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^https://yoursite.com/$ [NC]
RewriteCond %{QUERY_STRING} ^wc-ajax=get_refreshed_fragments$
RewriteRule ^(.*)$ $1 [R=204,L]
@damiencarbery
damiencarbery / custom-note-to-order-email.php
Last active May 4, 2023 10:04
Add info to WooCommerce order emails -
<?php
/*
Plugin Name: Custom note to order email
Plugin URI: https://www.damiencarbery.com/2018/07/add-info-to-woocommerce-order-emails/
Description: Add a note to the order email if the order contains products from the specified category.
Author: Damien Carbery
Version: 0.1
*/
/* Add note about shapetrousers delivery time to the order email. */
@lukecav
lukecav / functions.php
Created June 29, 2018 19:04
Disable the “Connect your store to WooCommerce.com to receive extensions updates and support.” admin notice from WooCommerce
add_filter( 'woocommerce_helper_suppress_admin_notices', '__return_true' );
@ankyit
ankyit / WordPress Performance.txt
Last active April 21, 2020 12:40
WordPress Performance
### Sites:
https://gtmetrix.com/
https://developers.google.com/speed/pagespeed/insights/
### Plugins
https://wordpress.org/plugins/query-monitor/
https://wordpress.org/plugins/autoptimize/
https://wordpress.org/plugins/wp-super-cache/
https://wordpress.org/plugins/ewww-image-optimizer/
https://wordpress.org/plugins/jetpack/
<?php
/*
Plugin Name: Move Variations above Short Description
Plugin URI: https://www.facebook.com/groups/advanced.woocommerce/permalink/2114573521890389/
Description: Move the variations and Add to Cart to be above the short description.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_styles_scripts', 99 );
function dequeue_woocommerce_styles_scripts() {
if ( function_exists( 'is_woocommerce' ) ) {
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
# Styles
wp_dequeue_style( 'woocommerce-general' );
wp_dequeue_style( 'woocommerce-layout' );
wp_dequeue_style( 'woocommerce-smallscreen' );
wp_dequeue_style( 'woocommerce_frontend_styles' );
@deeman
deeman / wc-noindex-nofollow.php
Last active March 9, 2022 12:17
(SEO) WooCommerce "No Index, No Follow" on cart, order, checkout- pages then using YOAST!
function woo_seo_noindex_special_pages () {
global $post;
$woocommerce_pages = array('cart', 'checkout', 'order-received', 'order-tracking',
'my-account', 'logout', 'lost-password', 'mijireh-secure-checkout');
$slug = get_post($post)->post_name;
if (in_array($slug, $woocommerce_pages)) {
echo '<meta name="robots" content="noindex,follow"/>' . "\n";
}