Skip to content

Instantly share code, notes, and snippets.

@spivurno
spivurno / gp-populate-anything-merge-tag-context-modifier.php
Last active April 2, 2023 07:40
Gravity Perks // Populate Anything // Replace Merge Tags in Specific Context
<?php
/**
* Gravity Perks // Populate Anything // Replace Merge Tags in Specific Context
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*
* @video https://www.loom.com/share/d626a60769ee48579b6f426a677918a3
*
* This snippet allows you to replace a merge tag in the context of an entry selected in a GPPA-populated field. For
* example, if you populate a Drop Down field with entries and then have an HTML field which includes the {all_fields}
* merge tag, you could use the context modifier to specify that Drop Down field as the context like so:
@spivurno
spivurno / gw-gravity-forms-manual-entries.php
Last active February 21, 2023 20:45
Gravity Wiz // Gravity Forms // Manual Entries
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-manual-entries.php
*/
/**
* Gravity Wiz // Gravity Forms // Manual Entries
*
* Create entries manually for Gravity Forms. Adds an "Add New" button next to the page title on all entry-related pages.
@spivurno
spivurno / gp-nested-forms-change-child-form-submit-button-text.php
Created December 31, 2018 19:56
Gravity Perks // GP Nested Forms // Change Submit Button Text for Child Form
<?php
/**
* Gravity Perks // GP Nested Forms // Change Submit Button Text for Child Form
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*/
add_filter( 'gform_pre_render_2', function( $form ) {
global $wp_current_filter;
if( ! is_callable( 'gp_nested_forms' ) ) {
return $form;
}
@spivurno
spivurno / gw-gravity-forms-minimum-characters.php
Last active December 28, 2022 09:17
Gravity Wiz // Require Minimum Character Limit for Gravity Forms
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-min-and-max-character-limit.php
*/
/**
* Gravity Wiz // Require Minimum Character Limit for Gravity Forms
*
* Adds support for requiring a minimum number of characters for text-based Gravity Form fields.
@spivurno
spivurno / gw-gravity-forms-filter-out-zero-dollar-products.php
Last active November 23, 2022 16:47
Gravity Wiz // Gravity Forms // Filter Out $0.00 Products
<?php
/**
* Gravity Wiz // Gravity Forms // Filter Out $0.00 Products
* http://gravitywiz.com/
*/
add_filter( 'gform_product_info', 'gw_remove_empty_products', 10, 3 );
function gw_remove_empty_products( $product_info, $form, $lead ) {
$products = array();
@spivurno
spivurno / gp-limit-choices-field-groups.php
Last active November 14, 2022 21:16
Gravity Perks // GP Limit Choices // Field Groups
<?php
/**
* Gravity Perks // GP Limit Choices // Field Group
*
* Specify a group of fields that should create a unique choice to limited. For example, a Date field and Radio Button field could be
* combined to sell x tickets per date where the ticket type is controlled by the Radio Button field and the date is
* selected in the Date field.
*
* @version 1.4
* @author David Smith <david@gravitywiz.com>
@spivurno
spivurno / gw-gravity-forms-day-count.php
Last active November 7, 2022 16:32
Gravity Wiz // Calculate Number of Days Between Two Gravity Form Date Fields
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-day-count.php
*/
/**
* Gravity Wiz // Calculate Number of Days Between Two Gravity Form Date Fields
*
* Allows you to calculated the number of days between two Gravity Form date fields and populate that number into a
@spivurno
spivurno / gist:5065194
Last active November 7, 2022 16:31
Gravity Wiz: Use Gravity Forms Conditional Logic with Dates
<?php
/**
* Use Gravity Forms Conditional Logic with Dates
* http://gravitywiz.com/use-gravity-forms-conditional-logic-with-dates/
*/
add_filter("gform_field_value_timestamp", "gwiz_populate_timestamp");
function gwiz_populate_timestamp( $value ){
return time();
}
@spivurno
spivurno / gw-gravity-forms-currencies.php
Created September 24, 2015 13:32
Gravity Wiz // Gravity Forms // Default Currencies
{
"USD": {
"name": "U.S. Dollar",
"symbol_left": "$",
"symbol_right": "",
"symbol_padding": "",
"thousand_separator": ",",
"decimal_separator": ".",
"decimals": 2
},
@spivurno
spivurno / gw-gravity-forms-export-multi-input-fields-single-colum.php
Last active November 4, 2022 18:12
Gravity Wiz // Gravity Forms // Export Multi-input Fields in a Single Column
<?php
/**
* Gravity Wiz // Gravity Forms // Export Multi-input Fields in a Single Column
*
* By default, Gravity Forms only allows you to export each input of a multi-input field (e.g. Checkbox field,
* Name Field, etc) as a separate column. This snippet allows you to export all inputs (of a specific field) in a
* single column.
*
* @version 1.2
* @author David Smith <david@gravitywiz.com>