Skip to content

Instantly share code, notes, and snippets.

<?php
add_action( 'gperk_field_settings', 'my_custom_setting' )
function my_custom_setting() {
?>
<li class="my-custom-field-setting field_setting">
<input type="checkbox" id="my-custom-setting" value="1" onclick="SetFieldProperty( 'myCustomSetting', this.checked);">
<label class="inline" for="my-custom-setting">
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-ajax-population.php
Created September 5, 2016 04:34 — forked from spivurno/gw-gravity-forms-ajax-population.php
Gravity Wiz // Gravity Forms // AJAX Popluation
<?php
/**
* Gravity Wiz // Gravity Forms // AJAX Population
*
* Populate one or many fields from a remote data source (only .csv files are currently supported) based on the selected value of a field on the form.
*
* Example: You have multiple brands of lumber. The lumber comes in different sizes. You can store each lumber brand and its corresponding length, width, and height in a spreadsheet (csv format) and then populate this data into separate length, width and height fields on the form when a lumber brand is selectd from a drop down field on the form.
*
* @version 1.1
* @author David Smith <[email protected]>
<?php
# First and Last Name
new GW_Rename_Uploaded_Files( array(
'form_id' => 628,
'field_id' => 3,
'template' => '{Name (First):1.3}-{Name (Last):1.6}-{filename}' // most merge tags are supported, original file extension is preserved
) );
# Form Title Merge Tag
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-value-exists-validation.php
Created September 5, 2016 04:37 — forked from spivurno/gw-gravity-forms-value-exists-validation.php
Gravity Wiz // Gravity Forms // Validate that a Value Exists
<?php
/**
* Gravity Wiz // Gravity Forms // Validate that a Value Exists
*
* Ensure that a value entered in Form A has been previously submitted on Form B. This is useful if you're generating a reference number of some sort
* on Form B and would like the user to enter it on Form A.
*
* @version 1.2
* @author David Smith <[email protected]>
* @license GPL-2.0+
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-create-coupons.php
Created September 5, 2016 04:38 — forked from spivurno/gw-gravity-forms-create-coupons.php
Gravity Wiz // Gravity Forms // Create Coupons with Gravity Forms for Gravity Forms, WooCommerce, or Easy Digital Downloads
<?php
/**
* Gravity Wiz // Gravity Forms // Create Coupons with Gravity Forms for Gravity Forms, WooCommerce, or Easy Digital Downloads
*
* Create coupons via Gravity Forms submissions. Map the coupon code to a field on the GF form and voila!
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link WooCommerce: http://gravitywiz.com/creating-coupons-woocommerce-gravity-forms/
<?php
/**
* Schedule a Post by Date Field Usage
*/
// change the form ID
add_filter( 'gform_post_data_546', 'gw_schedule_post_by_date_field', 10, 3 );
// set the date and time values by field
$date = $entry['7']; // CHANGE: "7" to the ID of your Date field
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-dynamic-select.php
Created September 5, 2016 04:39 — forked from spivurno/gw-gravity-forms-dynamic-select.php
Gravity Wiz // Gravity Forms // Dynamic Select (for Categories, Taxonomies and more)
<?php
/**
* Gravity Wiz // Gravity Forms // Dynamic Category Select
*
* Allows the user to drill down from a top level category to a child category.
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/.../
@phillipwilhelm
phillipwilhelm / gp-limit-choices-choiceless-message.php
Created September 5, 2016 04:40 — forked from spivurno/gp-limit-choices-choiceless-message.php
Gravity Perks // GP Limit Choices // Customize Choiceless Message
<?php
/**
* Gravity Perks // GP Limit Choices // Customize Choiceless Message
* http://gravitywiz.com/documentation/gp-limit-choices/
*
* This snippet allows you to modify the message that id displayed in place of a field when all of it's choices have been exhausted.
*/
add_filter( 'gplc_choiceless_message', 'my_choiceless_message', 10, 2 );
function my_choiceless_message( $message, $field ) {
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-auto-populate.php
Created September 5, 2016 04:40 — forked from spivurno/gw-gravity-forms-auto-populate.php
Gravity Wiz // Gravity Forms // Auto Populate
<?php
/**
* Gravity Wiz // Gravity Forms // Auto Populate
*
* Automatically populate a form with data based on an entry ID or an array of custom data.
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@phillipwilhelm
phillipwilhelm / gw-gravity-forms-populate-date-usage.php
Created September 5, 2016 04:41 — forked from spivurno/gw-gravity-forms-populate-date-usage.php
Gravity Wiz // Gravity Forms // Populate Date
<?php
/**
* Gravity Wiz // Gravity Forms // Populate Date (Usage)
*/
// populate current date (today)
new GW_Populate_Date( array(
'form_id' => 39,
'target_field_id' => 4,
) );