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 | |
/** | |
* Specify the default quantities here | |
* You'll need to update the child product IDs to match yours | |
*/ | |
function florian_child_quantity( $quantity_field_value, $child_product_id, $item ) { | |
if( $child_product_id == 267 ) { | |
$quantity_field_value = 3; | |
} | |
if( $child_product_id == 269 ) { |
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 | |
/** | |
* Force a child product to be automatically selected | |
*/ | |
function prefix_filter_default_child_independent_quantity( $quantity_field_value, $child_product_id, $item ) { | |
if( $child_product_id == 9999 ) { // Change this to your child product ID | |
return 1; | |
} | |
return $quantity_field_value; | |
} |
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 | |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); | |
require_once WP_CONTENT_DIR.'/plugins/amazon-web-services/vendor/aws/aws-autoloader.php'; | |
use \Aws\S3\S3Client; | |
add_filter('gform_upload_path', 'gform_change_upload_path', 10, 2); | |
add_action('gform_after_submission', 'gform_submit_to_s3', 10, 2); | |
//change gravity form upload path to point to S3 |
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 | |
/* Gravity Forms Word Count Script */ | |
function els_load_scripts() { | |
wp_enqueue_script('gravity-forms-word-count', get_stylesheet_directory_uri() . '/js/jquery.gravity_word_count.js', array('jquery'), '0.1', true); | |
} | |
add_action('wp_enqueue_scripts', 'els_load_scripts'); | |
/*Then in the form, for fields that need the word count, add the class ‘els-word-count[300].' Change [300] as needed for the maximum words that can be added to that particular field.*/ | |
/*Source http://www.gravityhelp.com/forums/topic/maximum-word-count#post-149331*/ |
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 | |
/** | |
* Display phone number field at checkout | |
* Add more here if you need to | |
*/ | |
function sumobi_edd_display_checkout_fields() { | |
// get user's phone number if they already have one stored | |
if ( is_user_logged_in() ) { |
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 | |
/** | |
* Automatic Url + Content Dir/Url Detection for Wordpress | |
*/ | |
$document_root = rtrim(str_replace(array('/', '\\'), '/', $_SERVER['DOCUMENT_ROOT']), '/'); | |
$root_dir = str_replace(array('/', '\\'), '/', __DIR__); | |
$wp_dir = str_replace(array('/', '\\'), '/', __DIR__ . '/wp'); | |
$wp_content_dir = str_replace(array('/', '\\'), '/', __DIR__ . '/wp-content'); |
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
(function () { | |
this.uniqid = function (pr, en) { | |
var pr = pr || '', en = en || false, result; | |
this.seed = function (s, w) { | |
s = parseInt(s, 10).toString(16); | |
return w < s.length ? s.slice(s.length - w) : (w > s.length) ? new Array(1 + (w - s.length)).join('0') + s : s; | |
}; | |
result = pr + this.seed(parseInt(new Date().getTime() / 1000, 10), 8) + this.seed(Math.floor(Math.random() * 0x75bcd15) + 1, 5); |