Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Gravity Perks // Nested Forms // Add `Required` label to Nested Form field
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
*
* Adds a `Required` label to a Nested Form field when a minimum child entry limit is set.
*/
// Replace `123` with your form ID and `4` with your Nested Form field ID
add_filter( 'gform_field_content_123_4', function ( $content, $field, $value, $lead_id, $form_id ) {
/**
* Gravity Perks // Nested Forms // Copy Parent Values To First Child Entry
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
*
* Copy parent values into the first child entry automatically. The `{Parent}` merge tag would typically be used
* for this but this would copy the values to all child entries, not just the first.
*/
gform.addAction( 'gpnf_init_nested_form', function( childFormId, gpnf ) {
// Update "123" to your the ID of your child form.
<?php
/**
* Gravity Perks // Populate Anything // LMT Extract First Letter
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*
* 🦄 This has now been added to the Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gp-populate-anything/gppa-lmt-extract-first-character.php
*
* Extract the first letter of a string using a Live Merge Tag
*/
<?php
/**
* Gravity Perks // Populate Anything // LMT URL Encode Characters
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*
* URL encode characters when populating a Live Merge Tag
*/
// Update "123" to your form ID; and "4" to the field you are copying from.
add_filter( 'gppa_live_merge_tag_value_123_4', function( $value ) {
return urlencode( $value );
<?php
/**
* Gravity Wiz // Gravity Forms // URL Encode Merge Tag Modifier
* https://gravitywiz.com
*
* Use the :url_encode modifier on merge tags to URL encode the value
*
* this: Advanced Save & Continue
* to: Advanced+Save+%26+Continue
*/
@matty0501
matty0501 / gpeb-navigation-with-filtered-choices.php
Last active October 2, 2024 07:46 — forked from saifsultanc/gpeb-navigation-with-filtered-choices.php
gpeb-navigation-with-filtered-choices.php
<?php
// helper method
function get_array_subset( $array, $offset, $limit ) {
if ( $offset > count( $array ) - 1) {
return [];
}
$start = $offset;
$length = min( $limit, count( $array ) - $offset );
return array_slice( $array, $start, $length );