Skip to content

Instantly share code, notes, and snippets.

@damiencarbery
damiencarbery / disable-cf7.php
Last active February 22, 2020 06:04
Disable Contact Form 7 plugin except for certain pages.
<?php
/*
Plugin Name: Disable CF7 plugin
Plugin URI: http://www.damiencarbery.com
Description: Disable Contact Form 7 plugin except for certain pages.
Author: Damien Carbery
Version: $Revision: $
$Id: $
*/
@helgatheviking
helgatheviking / price-upon-request.php
Created May 6, 2017 17:49
Switch Free prices to "Price upon Request"
<?php
/**
* Plugin Name: Price Upon Request
* Plugin URI: https://gist.github.com/helgatheviking/6278f960f5fb7fca101e75f30f33141c
* Description: Switch Free prices to "Price upon Request"
* Version: 0.1.0
* Author: helgatheviking
* Author URI: https://kathyisawesome.com
* Requires at least: 4.7
* Tested up to: 4.7
@mgibbs189
mgibbs189 / functions.php
Last active May 2, 2024 09:34
Flatsome - support lazy load images and quick view
<?php
add_action( 'wp_head', function() {
?>
<script>
(function($) {
$(document).on('facetwp-loaded', function() {
Flatsome.behaviors['lazy-load-images'].attach();
Flatsome.behaviors['quick-view'].attach();
});
@dasbairagya
dasbairagya / functions.php
Created May 4, 2017 08:37
Add custom columns to the user table of the admin dashbord
<?php /**
* Adds a custom column to the user display dashboard.
*
* @param $columns The array of columns that are displayed on the user dashboard
* @return The updated array of columns now including zip codes.
*/
function new_modify_user_table( $column ) {
$column['register_phone'] = 'Phone';
$column['zip_code'] = 'Zip';
return $column;
@KZeni
KZeni / cf7-success-page-redirects.php
Last active September 20, 2018 06:19
Contact Form 7 - Success Page Redirects version 1.2.0 plugin fix (fixes conflict with Flamingo add-on and also makes it work with & without AJAX enabled on the form) as mentioned on https://wordpress.org/support/topic/compatibility-issue-with-flamingo-official-plugin-for-storing-cf7-submissions/
<?php
/**
* Plugin Name: Contact Form 7 - Success Page Redirects
* Description: An add-on for Contact Form 7 that provides a straightforward method to redirect visitors to success pages or thank you pages.
* Version: 1.2.0
* Author: Ryan Nevius
* Author URI: http://www.ryannevius.com
* License: GPLv3
*/
@digitalchild
digitalchild / functions.php
Created April 25, 2017 03:37
check address
<?php
add_action( 'woocommerce_checkout_process', 'address_has_number');
function address_has_number() {
$billing_address_1 = $_POST[ 'billing_address_1' ];
if ( preg_match('/^\d/', $billing_address_1 ) === 1 ){
wc_add_notice( __( 'Your address does not have a number.' ), 'error' );
@DanielSantoro
DanielSantoro / email-styles.php
Created April 19, 2017 16:13
Email Styles in WC
<?php
/**
* Email Styles
*
* This template can be overridden by copying it to yourtheme/woocommerce/emails/email-styles.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
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
function my_wc_custom_get_price_html( $price, $product ) {
if ( $product->get_price() == 0 ) {
if ( $product->is_on_sale() && $product->get_regular_price() ) {
$regular_price = wc_get_price_to_display( $product, array( 'qty' => 1, 'price' => $product->get_regular_price() ) );
$price = wc_format_price_range( $regular_price, __( 'Free!', 'woocommerce' ) );
} else {
$price = '<span class="amount">' . __( 'Free!', 'woocommerce' ) . '</span>';
}
}
@mikejolley
mikejolley / functions.php
Created April 7, 2017 11:34
WooCommerce 3.0 - Disable deferred email sending
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_filter( 'woocommerce_defer_transactional_emails', '__return_false' );
@rynaldos-zz
rynaldos-zz / wc-show-free.php
Last active September 6, 2017 18:00
[WooCommerce 3.0+] Re-instate "Free" instead of 0 value
function my_wc_custom_get_price_html( $price, $product ) {
if ( $product->get_price() == 0 ) {
if ( $product->is_on_sale() && $product->get_regular_price() ) {
$regular_price = wc_get_price_to_display( $product, array( 'qty' => 1, 'price' => $product->get_regular_price() ) );
$price = wc_format_price_range( $regular_price, __( 'Free!', 'woocommerce' ) );
} else {
$price = '<span class="amount">' . __( 'Free!', 'woocommerce' ) . '</span>';
}
}