Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Gravity Perks // Populate Anything // Add Line Break Between Live Merge Tag Checkbox Values
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
// Update "123" with your form ID and "4" with your Checkbox field ID.
add_filter( 'gppa_live_merge_tag_value_123_4', function( $value, $merge_tag, $form, $field_id, $entry_values ) {
$values = array_map( 'trim', explode( ',', $value ) );
return implode( '<br>', $values );
}, 10, 5 );
@spivurno
spivurno / gw-gravity-forms-round-robin.php
Last active September 22, 2020 12:57
Gravity Wiz // Gravity Forms // Round Robin
<?php
/**
* Gravity Wiz // Gravity Forms // Round Robin
*
* Cycle through the choices of a designated field assigning the next available choice when an entry is submitted. The
* cycle starts with the first choice progressing to the next available choice on each submission. After each choice has
* been assigned it will restart from the first choice.
*
* This functionality is useful when distributing leads evenly to a group of sales reps, scheduling shifts such that
* employees are assigned to the next available shift, and/or balancing the responsibility of any task-oriented
/**
* Gravity Perks // Pay Per Word // Split Words on Specific Characters (JS)
* https://gravitywiz.com/documentation/gravity-forms-pay-per-word/
*/
gform.addFilter( 'gpppw_word_count', function( wordCount, text, gwppw, ppwField, formId ) {
// Splits words on periods, underscores, and asterisks.
var words = text.replace( /[\.\_\*]/g, ' ' ).match( /\S+/g );
return words == null ? 0 : words.length;
} );
<?php
add_filter( 'gpecf_order_sumary_markup', 'get_custom_order_summary_markup', 10, 6 );
function get_custom_order_summary_markup( $markup, $order, $form, $entry, $order_summary, $labels ) {
ob_start();
?>
<table class="gpecf-order-summary" cellspacing="0" width="100%" style="<?php gp_ecommerce_fields()->style( '.order-summary' ); ?>">
<thead>
<tr>
<th scope="col" style="<?php gp_ecommerce_fields()->style( '.order-summary/thead/th.column-1' ); ?>"><?php echo $labels['product']; ?></th>
@spivurno
spivurno / gw-gravity-forms-shortcodes-as-merge-tags.php
Created February 24, 2020 15:19
Gravity Wiz // Gravity Forms // Shortcodes as Merge Tags for Gravity Forms Conditional Shortcode
<?php
/**
* Gravity Wiz // Gravity Forms // Shortcodes as Merge Tags for Gravity Forms Conditional Shortcode
* http://gravitywiz.com/
*
* Requires Gravity Forms 2.4.17.2+
*
* Usage:
*
* 1. First convert your shortcode into a merge tag.
@spivurno
spivurno / gp-populate-anything-populate-multi-file-upload-as-separate-choices.php
Created February 5, 2020 13:34
Gravity Perks // Populate Anything // Populate Multi-file Upload Images as Separate Choices
<?php
/**
* Gravity Perks // Populate Anything // Populate Multi-file Upload Images as Separate Choices
* http://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
// Update "123" to your form ID; update "4" to the ID the field you're populating via Populate Anything.
add_filter( 'gppa_input_choices_123_4', function( $choices, $field, $objects ) {
$parsed_choices = array();
foreach( $choices as $choice ) {
$_choices = explode( ', ', $choice['value'] );
@media only screen and (max-width: 480px) {
.ui-datepicker.ui-datepicker-inline {
width: 100%;
}
.ui-datepicker.ui-datepicker-inline td span, .ui-datepicker.ui-datepicker-inline td a {
width: auto;
display: block;
}
@spivurno
spivurno / gp-easy-passthrough-save-token-to-field.php
Created January 23, 2020 14:47
Gravity Perks // Easy Passthrough // Save EP Token to Field
<?php
/**
* Gravity Perks // Easy Passthrough // Save EP Token to Field
* http://gravitywiz.com/documentation/gravity-forms-easy-passthrough/
*
* This snippet allows you to populate the EP token into a field so it can be mapped in Gravity Forms feeds. The filter
* fires before feeds are processed so the token is available in time.
*/
// Update "123" to your form ID.
add_filter( 'gform_entry_post_save_123', function( $entry, $form ) {
@spivurno
spivurno / gw-gravity-forms-check-if-form-will-be-loaded.php
Last active October 27, 2021 14:59
Gravity Wiz // Gravity Forms // Check If Form Will Be Loaded on Page
<?php
/**
* Gravity Wiz // Gravity Forms // Check If Form Will Be Loaded on Page
* http://gravitywiz.com/
*
* This snippet will allow you to check if a form will be loaded on the current page and do something if it will be.
* Note: this is a simple version that will only work on singular views where the [gravityforms] shortcode is used in
* the post content.
*
* @todo:
@spivurno
spivurno / gp-easy-passthrough-edit-entry.php
Last active November 10, 2021 19:39
Gravity Perks // Easy Passthrough // Edit Entry
<?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-easy-passthrough/gpep-edit-entry.php
*/
/**
* Gravity Perks // Easy Passthrough // Edit Entry
*
* Edit entry ID specified in field with current form submission.