Skip to content

Instantly share code, notes, and snippets.

@spivurno
spivurno / gpfup-big-images.css
Last active Jan 22, 2021
Gravity Perks // File Upload Pro // Big Images
View gpfup-big-images.css
.gpfup-big-images .gpfup__files {
display: flex;
flex-wrap: wrap;
border: 0;
padding: 0;
box-shadow: none;
margin: 0 -0.5rem;
}
.gpfup-big-images .gpfup__file {
@spivurno
spivurno / gp-limit-choices-shared-limits-field.php
Created Jul 30, 2020
Gravity Perks // Limit Choices // Shared Limits Field
View gp-limit-choices-shared-limits-field.php
<?php
/**
* Gravity Perks // Limit Choices // Shared Limits Field
*
* Share limits across choices of the same field.
*
* @version 1.0
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/documentation/gravity-forms-limit-choices/
@spivurno
spivurno / gp-populate-anything-populate-child-entries.php
Last active Sep 9, 2020
Gravity Perks // Populate Anything // Populate Child Entries
View gp-populate-anything-populate-child-entries.php
<?php
/**
* Gravity Perks // Populate Anything // Populate Child Entries
*
* Populate child entries from a Nested Form field into any multi-choice field.
*
* Instructional Video:
* https://www.loom.com/share/7b26b18f78624e0ca4bcd2b574636b8b
*
* Step 1 - Configure a Parent Entry Field
@spivurno
spivurno / gf-2.5-markup-comparison.html
Created Jul 15, 2020
Gravity Forms 2.5 Markup Comparison
View gf-2.5-markup-comparison.html
// New Markup
<div id="gform_fields_893" class="gform_fields top_label form_sublabel_below description_below">
<fieldset id="field_893_4" class="gfield field_sublabel_below field_description_below gfield_visibility_visible">
<legend class="gfield_label gfield_label_before_complex">Name C</legend>
<div class="ginput_complex ginput_container no_prefix has_first_name no_middle_name has_last_name no_suffix gf_name_has_2 ginput_container_name" id="input_893_4">
<span id="input_893_4_3_container" class="name_first">
<input type="text" name="input_4.3" id="input_893_4_3" value="" aria-label="First name" aria-required="false">
<label for="input_893_4_3">First</label>
</span>
@spivurno
spivurno / gw-gravity-forms-choice-counter.php
Last active Sep 9, 2020
Gravity Wiz // Gravity Forms // Choice Counter
View gw-gravity-forms-choice-counter.php
<?php
/**
* Gravity Wiz // Gravity Forms // Choice Counter
*
* Get the total number of checkboxes checked or multi-select options selected. Useful when wanting to apply conditional
* logic based on those totals.
*
* @version 1.0
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
@spivurno
spivurno / gp-populate-anything-merge-tag-context-modifier.php
Last active Apr 5, 2021
Gravity Perks // Populate Anything // Replace Merge Tags in Specific Context
View gp-populate-anything-merge-tag-context-modifier.php
<?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 / gp-nested-forms-triggered-population.php
Last active Apr 10, 2021
Gravity Perks // Nested Forms // Add Child Entry on Trigger
View gp-nested-forms-triggered-population.php
<?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
@spivurno
spivurno / gp-populate-anything-set-current-form-on-duplicate.php
Last active May 7, 2020
Gravity Perks // Populate Anything // Auto-update Form ID on Form Duplication
View gp-populate-anything-set-current-form-on-duplicate.php
<?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 ) {
@spivurno
spivurno / wp-sessions-gf-out-of-the-box.php
Created Apr 21, 2020
WP Sessions // Gravity Forms Out of the Box // Bed & Breakfast Demo
View wp-sessions-gf-out-of-the-box.php
<?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() {
@spivurno
spivurno / gp-populate-anything-force-dyn-pop-on-gv-edit.php
Created Apr 6, 2020
Gravity Perks // Populate Anything // Force Dynamic Population When Editing via Gravity View
View gp-populate-anything-force-dyn-pop-on-gv-edit.php
<?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 );