This file contains 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
<?php | |
define('SITE_EMAIL', 'no-reply@example.com'); | |
define('SITE_NAME', 'My Project'); | |
function send_password_reset($email, $name, $resetlink) { | |
require_once( 'swiftmailer/swift_required.php' ); | |
$subject = 'Resetting your password for ' . SITE_NAME; |
This file contains 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
<?php | |
function url_exists( $url ) { | |
$headers = get_headers($url); | |
return stripos( $headers[0], "200 OK" ) ? true : false; | |
} | |
function get_youtube_id( $url ) { | |
$youtubeid = explode('v=', $url); | |
$youtubeid = explode('&', $youtubeid[1]); |
This file contains 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
// inspired by https://gist.github.com/jshawl/6225945 | |
// Thanks @jshawl! | |
// now using grunt-sass to avoid Ruby dependency | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
sass: { // sass tasks | |
dist: { |
This file contains 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
<?php | |
// This adds a hard coded Amazon affiliate tag to all amazon links in the_content | |
// Code adapted from the abandoned "Amazon Affiliate Tag" plugin | |
// https://wordpress.org/plugins/amazify/ by Maxime Bridon https://bridon.fr/ | |
function add_amazon_tag( $content ) { | |
// the affiliate tag for Peter Bregman | |
$affiliate_tag = 'yourtaghere-123'; | |
// regex to find any link |
This file contains 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
[ | |
{ | |
"key": "group_5aa17612b7168", | |
"title": "Page Fields with Gutenberg", | |
"fields": [ | |
{ | |
"key": "field_5aa1807a67935", | |
"label": "Message", | |
"name": "", | |
"type": "message", |
This file contains 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
document.addEventListener( 'wpcf7mailsent', function(event) { | |
// console.log(event.detail.contactFormId, event); | |
switch( event.detail.contactFormId ) { | |
case "1234": | |
// thank you page for form ID 1234 "My Form 1" | |
location='https://example.com/form1/thank-you/'; | |
break; | |
case "1235": | |
// thank you page for form ID 1235 "My Form 2" | |
location='https://example.com/form2/thank-you/'; |
This file contains 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
# These are the only common ones ever used... | |
# If you need a reference for anything inbetween these: https://tools.ietf.org/html/rfc4632#page-7 | |
123.456.0.0/8 = 123.*.*.* | |
123.456.0.0/16 = 123.456.*.* | |
123.456.789.0/24 = 123.456.789.* | |
123.456.789.012/32 = 123.456.789.012 |
This file contains 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
<?php | |
// account for conflicts between GiveWP Stripe AND WooCommerce Stripe script loading | |
function squarecandy_givewp_woocommerce_stripe_resolve() { | |
// check if both Stripe plugins are active | |
if ( is_plugin_active( 'woocommerce-gateway-stripe/woocommerce-gateway-stripe.php' ) && is_plugin_active( 'give-stripe/give-stripe.php' ) ) : | |
// WC doesn't load stripe on every page. | |
// Check if they are both being enqueued in the current context before disabling one. | |
if ( wp_script_is( 'stripe', 'enqueued' ) && wp_script_is( 'give-stripe-js', 'enqueued' ) ) { | |
// @TODO - should we compare and make sure the file contents are actually the same here? | |
This file contains 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
<?php | |
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' ); | |
/** | |
* custom_woocommerce_template_loop_add_to_cart | |
*/ | |
function custom_woocommerce_product_add_to_cart_text() { | |
global $product; | |
$product_type = $product->get_type(); |
This file contains 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
<?php | |
/* | |
Plugin Name: Square Candy WooCommerce Customizations |