This file contains hidden or 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 | |
/** | |
* 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/gp-nested-forms/gpnf-triggered-population.php | |
*/ | |
/** | |
* Gravity Perks // Nested Forms // Add Child Entry on Trigger | |
* | |
* Auto-add a child entry to a Nested Form field, created with data from your parent form. This is useful when wanting |
This file contains hidden or 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 Perks // Populate Anything // Auto-update Form ID on Form Duplication | |
* http://gravitywiz.com/documentation/gravity-forms-populate-anything/ | |
* | |
* When populating Gravity Forms Entries via Populate Anything, it can save time to automatically update the selected | |
* form ID to the new form ID when duplicating an existing form. To enable on any field, just set the | |
* "gppa-set-current-form" class on the CSS Class Name setting. | |
*/ | |
add_action( 'gform_post_form_duplicated', function( $form_id, $new_id ) { |
This file contains hidden or 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 | |
/** | |
* WP Sessions // Gravity Forms Out of the Box // Bed & Breakfast Demo | |
* http://wpsessions.com/sessions/gravity-forms-out-of-the-box/ | |
* http://gravitywiz.com | |
*/ | |
add_action( 'init', 'register_bnb_room_post_type', 0 ); | |
function register_bnb_room_post_type() { |
This file contains hidden or 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 Perks // Populate Anything // Force Dynamic Population When Editing via Gravity View | |
* http://gravitywiz.com/documentation/gravity-forms-populate-anything/ | |
*/ | |
add_filter( 'gravityview/edit_entry/field_value', function( $field_value, $field ) { | |
// Update "123" to your form ID and "4" to your field ID. | |
if ( $field->formId == 123 && $field->id == 4 ) { | |
if ( isset( $GLOBALS['gppa-field-values'] ) ) { | |
$hydrated_field = gp_populate_anything()->hydrate_field( $field, GFAPI::get_form( $field->formId ), array(), null, false ); |
This file contains hidden or 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 Perks // Limit Submissions + Nested Forms // Scope Limit Feeds to Current Parent Entry | |
* http://gravitywiz.com/documentation/gravity-forms-limit-submissions/ | |
*/ | |
add_action( 'gpls_before_query', function( $ruletest ) { | |
global $wpdb; | |
// Update "123" to your child form ID. | |
if( $ruletest->form_id == 123 && class_exists( 'GPNF_Session' ) && $parent_form_id = rgpost( 'gpnf_parent_form_id' ) ) { |
This file contains hidden or 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 Perks // eCommerce Fields // Show GPECF Fields in WooCommerce Cart Item Description | |
* http://gravitywiz.com/documentation/gravity-forms-ecommerce-fields/ | |
*/ | |
add_action( 'init', function() { | |
remove_filter( 'gform_pre_render', array( gp_ecommerce_fields(), 'add_wc_class_to_hide_fields_in_cart_description' ) ); | |
}, 11 ); |
This file contains hidden or 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 Perks // Media Library // Set Upload Directory | |
* http://gravitywiz.com/documentation/gravity-forms-media-library/ | |
*/ | |
add_filter( 'gpml_media_data', function( $return ) { | |
add_filter( 'upload_dir', 'gpml_set_upload_dir' ); | |
if( ! function_exists( 'gpml_set_upload_dir' ) ) { | |
function gpml_set_upload_dir( $upload_dir ) { | |
$upload_dir['path'] = ABSPATH . 'wp-content/uploads/paramountregistry'; |
This file contains hidden or 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 Wiz // Gravity Forms // Email Header to Identify Notification Source | |
* | |
* You've installed Gravity Forms on a ton of sites and now you're getting a ton of notifications. The problem is there | |
* is no clear indicator which site is sending the notification. How frustrating! | |
* | |
* This simple plugin automatically adds a custom header that identifies the URL that generated the Gravity Forms notification. | |
* This is most useful when installed as an MU plugin at the start of development on each site. | |
* |
This file contains hidden or 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
/** | |
* Gravity Perks // Pay Per Word // Surprise, Pay Per Character! | |
* https://gravitywiz.com/documentation/gravity-forms-pay-per-word/ | |
*/ | |
gform.addFilter( 'gpppw_word_count', function( wordCount, text, gwppw, ppwField, formId ) { | |
// Pay per character instead of words. | |
var words = text.split( '' ); | |
return words == null ? 0 : words.length; | |
} ); |