Skip to content

Instantly share code, notes, and snippets.

@chrisegg
chrisegg / gravity-forms-entries-unread-indicator.php
Created January 23, 2025 22:14
Adds a unread indicator to Gravity Forms entries menu in the WordPress admin.
<?php
/**
* Plugin Name: Gravity Forms Unread Entries Indicator
* Description: Adds an indicator to the Gravity Forms Entries menu showing the number of unread entries.
* Version: 1.0
* Author: Chris Egglelston
* Website: https://gravityranger.com
*/
if (!defined('ABSPATH')) {
@chrisegg
chrisegg / generateblocks-popup-modal.css
Last active January 6, 2025 03:03
This JavaScript code creates a popup modal functionality for GenerateBlocks blocks.
.hidden-block {
display: none;
}
.hidden-block.show {
display: block;
}
.popup-modal {
display: none; /* Hidden by default */
position: fixed;
@chrisegg
chrisegg / gravity-forms-show-field-id.js
Created January 4, 2025 16:41
This script dynamically adds custom-styled Field IDs to all fields (next to the label) in the Gravity Forms editor, allowing administrators to easily identify field IDs.
/**
* Gravity Forms Field ID Display
* Author: Chris Eggleston
* Version: 1.1
*
* Description: This script dynamically adds custom-styled Field IDs to all fields in the Gravity Forms editor,
* allowing administrators to easily identify field IDs.
*
* How to use:
* - Include this script on pages where the Gravity Forms editor is loaded.
@chrisegg
chrisegg / gf_shortcode_show_remaining_entry_number.php
Last active March 14, 2025 01:04
This shortcode dynamically calculates and displays the remaining availability entries for a Gravity Forms form based on the number of form entries submitted and the entry limit settings.
<?php
/**
* Entries Remaining Shortcode
*
* This shortcode dynamically calculates and displays the remaining availabile entries
* for a Gravity Forms form based on the number of form entries submitted.
*
* Usage: Enable entry limits in form settings and set your limit number. Then add the shortcode [spots_available] to an
* HTML field in your form or to a WordPress post or page where a Gravity Form is embedded.
*
@chrisegg
chrisegg / gr-change-entry-date-metabox.php
Last active February 5, 2025 23:49
Change the entry date with a new meta box in the entry details page.
<?php
/**
* Plugin Name: Gravity Forms Change Entry Date
* Plugin URI: https://gravityranger.com/gravity-forms-changing-the-entry-date
* Description: Adds a meta box to Gravity Forms entry details page allowing admins to change the entry date.
* Version: 1.0
* Author: Chris Eggleston
* Author URI: https://gravityranger.com
* License: GPL-2.0+
*/
@chrisegg
chrisegg / gforms-multi-date-picker.php
Created November 5, 2024 22:56
Gravity Forms: Adds the calendar picker to a single line text field and supports selecting multiple dates in the text field.
<?php
/**
* Gravity Forms // Multi-Date Picker Field
* https://gravityranger.com/gravity-forms-multi-date-picker/
*
* Allows selection of multiple dates in a single Gravity Forms text field.
*
* Step-by-Step Tutorial: https://gravityranger.com/gravity-forms-multi-date-picker/
*
* Instructions:
@chrisegg
chrisegg / gforms-limit-coupon-per-customer.php
Last active January 14, 2025 00:12
Snippet will compare the email address to the coupon entered if the email has already been used validation fails, and a custom validation message is shown.
<?php
/**
* Gravity Forms // Limit Coupon Usage Per Customer Based on Email Address
* https://gravityranger.com/gravity-forms-limit-coupon-per-customer/
*
* Snippet will compare the email address to the coupon entered if the email has already
* been used validation fails, and a custom validation message is shown.
*
* Step-by-Step Tutorial: https://gravityranger.com/gravity-forms-limit-coupon-per-customer/
*
@chrisegg
chrisegg / gforms-hide-from-entries.php
Created November 5, 2024 22:51
Using a CSS class 'hide-from-entries' you can prevent fields from showing in the entry details page. Add the class to the fields Custom CSS Class area.
<?php
/**
* Gravity Forms // Remove fields from entry details page
* https://gravityranger.com/
*
* Using a CSS class 'hide-from-entries' you can prevent fields from showing in the entry
* details page. Add the class to the fields Custom CSS Class area.
*
* Step-by-Step Tutorial: https://gravityranger.com/gravity-forms-hide-from-entries/
@chrisegg
chrisegg / change-radio-choice-selection.js
Created October 17, 2024 23:38
This snippet will change a selection in a radio button field when entering a value to another field.
/**
* Gravity Ranger // Gravity Forms // Change radio button choice when adding value to another field
* https://gravityranger.com/gravity-forms-fancy-donation-form
*
* This snippet will change a selection in a radio button field when entering a value to another field.
* Intended for a donation form with a price select field and and a user defined price field.
*
*/
<script type="text/javascript">
@chrisegg
chrisegg / select-field-choice-button-click.js
Created August 23, 2024 16:15
this snippet will allow you to add a button to your page with a specific CSS class that, when clicked, will make a selection in a radio button field choice. You must map the field choices in this code using the choice values.
/**
* GravityRanger // Gravity Forms // Select Field Choice with Button Click
* https://gravityranger.com/linking-button-to-gravity-forms-radio-button-choice/
*
* By default, this snippet will allow you to add a button to your page with a specific CSS class that, when clicked,
* will make a selection in a radio button field choice. You must map the field choices in this code using the choice values.
*/
// You will need to modify the code replacing basic, pro, and elite with your CSS classes and choice values