Skip to content

Instantly share code, notes, and snippets.

View gp-populate-anything-post-meta-as-choices.php
<?php
/**
* Gravity Perks // Populate Anything // Populate Post Meta as Choices
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
// Update "123" with your form ID; Update "4" with your field ID.
add_filter( 'gppa_input_choices_123_4', function( $choices, $field, $objects ) {
$custom_field = str_replace( 'meta_', '', $field['gppa-choices-templates']['label'] );
$meta = get_post_meta( $objects[0]->ID, $custom_field );
View gp-multi-page-navigation.php
<?php
/**
* Gravity Perks // Multi-page Navigation // Bypass Validation on Next
* https://gravitywiz.com/documentation/gravity-forms-multi-page-navigation/
*
* Bypass validation when clicking the next button. Navigation Activation Type must be set to "from the start".
*/
add_filter( 'gform_form_tag', function( $tag ) {
$tag .= '<input type="hidden" name="gw_bypass_validation" value="1">';
return $tag;
View gp-unique-id-date-specific-sequences.php
<?php
/**
* GP Unique ID // Gravity Perks // Date-specific Sequences
* http://gravitywiz.com/
*
* Requirements:
* - Your form ID cannot be more than 3 digits.
* - Your field ID cannot be more than 2 digits.
*/
// Update "123" to your form ID. Update "4" to your Unique ID field ID.
View gp-nested-forms-hourly-cron.php
<?php
/**
* Gravity Perks // Nested Forms // Hourly Cron & Orphaned Entry Expiration
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*/
function gpnf_custom_hourly_cron() {
if( ! is_callable( 'gp_nested_forms' ) ) {
return;
}
View gp-conditional-pricing-fix-gv-page-number-validation-conflict.php
<?php
/**
* Gravity Perks // Conditional Pricing + GravityView // Fix Page Number Validation Conflict
* http://gravitywiz.com/documentation/gravity-forms-conditional-pricing/
*/
add_filter( 'gform_pre_validation', function( $form ) {
if( is_callable( 'gravityview' ) && gravityview()->request->is_edit_entry() !== false ) {
foreach( $form['fields'] as &$field ) {
$field->pageNumber = 1;
}
View gp-limit-submissions-value-specific-limits.php
<?php
/**
* Gravity Perks // Limit Submissions // Value-specific Limits by Field
* http://gravitywiz.com/documentation/gravity-forms-limit-submissions/
*
* Form Export: https://gwiz.io/2Nm2JC2
* Feed Config: https://gwiz.io/2GJ2mRV
*/
// Update "123" to your form ID.
add_filter( 'gpls_rule_groups_123', function( $groups ) {
View gp-ecommerce-fields-consolidate-discounts.php
<?php
/**
* Gravity Perks // eCommerce Fields // Consolidate Separate Discount Line Items into a Single Discounts Line Item
* http://gravitywiz.com/documentation/gravity-forms-ecommerce-fields/
*
* Default: https://gwiz.io/2IiPALf
* w/ Snippet: https://gwiz.io/2Itfyfo
*/
// Update "123" to your form ID - or - remove "_123" to apply to all forms.
add_filter( 'gpecf_order_summary_123', function( $summary ) {
View gp-limit-dates-disable-all-dates-with-exceptions.php
<?php
/**
* Gravity Perks // Limit Dates // Disable All Dates & Set Enabled Dates via Exceptions
* http://gravitywiz.com/documentation/gravity-forms-limit-dates/
*/
add_filter( 'gpld_limit_dates_options_123_1', function( $options, $form, $field ) {
$options['exceptionMode'] = 'enable';
$options['disableAll'] = true;
View gp-nested-forms-reorder-display-fields.php
<?php
/**
* Gravity Perks // Nested Forms // Re-order Display Fields
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*/
// Update "123" to your form ID.
add_filter( 'gform_pre_render_123', function( $form ) {
foreach( $form['fields'] as &$field ) {
// Update "2" to your Nested Form field ID.
if( $field->id = 2 ) {
View gp-conditional-logic-dates-wc-gf-product-add-ons.php
<?php
/**
* Gravity Perks // Conditional Logic Dates // Fix Conflict w/ WC GF Product Add-ons
* http://gravitywiz.com/documentation/gravity-forms-conditional-logic-dates/
*/
add_filter( 'woocommerce_get_cart_item_from_session', function( $return ) {
add_filter( 'gform_form_post_get_meta', function( $form ) {
if( class_exists( 'GP_Conditional_Logic_Dates' ) ) {
$form = GP_Conditional_Logic_Dates::$instance->modify_frontend_form_object( $form );
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.