Skip to content

Instantly share code, notes, and snippets.

View saifsultanc's full-sized avatar
🏠
Remote

Saif Sultan saifsultanc

🏠
Remote
View GitHub Profile
/* Stack the groups vertically */
.gpb-booking-time-picker__grid {
display: flex;
flex-direction: column;
}
/* Each section stays in its own row */
.gpb-time-group {
display: flex;
flex-direction: column;
@saifsultanc
saifsultanc / gpb-split-time-slots.js
Last active February 20, 2026 15:03
gpb-split-time-slots.js
const config = {
first_start: "07:00",
first_end: "16:59",
second_start: "17:00",
second_end: "23:59",
first_label: "Lunch Time",
second_label: "Dinner Time"
};
function timeToMinutes(timeStr) {
<?php
/**
* Gravity Forms Credit Card Fee Field
*
* Adds a new field type to Gravity Forms that automatically calculates and adds credit card processing fees
* to orders. The fee is calculated based on a configurable fixed fee + percentage rate.
* Ensure the form has a total or subtotal field for accurate calculations.
*/
// Ensure this runs after all plugins are loaded.
add_action(
<?php
add_action( 'gform_update_status', function( $entry_id, $status, $previous_status ) {
// When entry is marked as spam.
if ( $status !== 'spam' || $previous_status === 'spam' ) {
return;
}
$entry = GFAPI::get_entry( $entry_id );
@saifsultanc
saifsultanc / gpmpn-dropdown.js
Created January 27, 2026 16:33
gpmpn-dropdown.js
/**
* Gravity Perks // Multi-page Navigation // Dropdown Navigation
* https://gravitywiz.com/documentation/gravity-forms-multi-page-navigation/
*
* Instruction Video: https://www.loom.com/share/38fcc941036842d6a81a599fd8de39d7
*
* This snippet is designed to be used with the Gravity Forms Code Chest plugin.
* https://gravitywiz.com/gravity-forms-code-chest/
*/
const pageNameTemplate = 'Step {pageNumber}: {pageName}';
@saifsultanc
saifsultanc / gpqr-translate-qr-scanner-spanish.js
Created December 16, 2025 13:03
gpqr-translate-qr-scanner-spanish.js
/**
* Gravity Perks // GP QR Code // Translate QR Scanner Interface to Spanish
* https://gravitywiz.com/documentation/gravity-forms-qr-code/
*
* Instructions:
*
* 1. Install this snippet with our free Custom JavaScript plugin.
* https://gravitywiz.com/gravity-forms-code-chest/
*/
( function( $ ) {
<?php
<?php
/**
* Gravity Perks // Populate Anything // Recteurs d'Académie JSON
*/
class GPPA_Object_Type_Recteurs extends GPPA_Object_Type {
public function __construct( $id ) {
parent::__construct( $id );
@saifsultanc
saifsultanc / GWCalcSubtotal.php
Created November 8, 2025 15:37
GWCalcSubtotal.php
<?php
/**
* Gravity Wiz // Gravity Forms // Calculation Subtotal Merge Tag
* https://gravitywiz.com/subtotal-merge-tag-for-calculations/
*
* Adds a {subtotal} merge tag which calculates the subtotal of the form.
*
* This merge tag can only be used within the "Formula" setting of Calculation-enabled fields (i.e. Number, Calculated Product).
*
* Plugin Name: Gravity Forms Subtotal Merge Tag
@saifsultanc
saifsultanc / gpro-enable-when-dynamically-populated.php
Created November 6, 2025 15:34
gpro-enable-when-dynamically-populated.php
<?php
add_filter( 'gform_pre_render', function ( $form, $ajax, $field_values ) {
if ( ! session_id() ) {
session_start();
}
if ( ! isset( $_SESSION['gwreadonly_disabled_fields'] ) ) {
$_SESSION['gwreadonly_disabled_fields'] = array();
}
$gwreadonly_disabled_fields = $_SESSION['gwreadonly_disabled_fields'];
@saifsultanc
saifsultanc / gw-update-posts.php
Created October 1, 2025 09:47
ACF multi-selects and serialized data.
<?php
/**
* Gravity Wiz // Gravity Forms // Update Posts
* https://gravitywiz.com/how-to-update-posts-with-gravity-forms/
*
* Update existing post title, content, author and custom fields with values from Gravity Forms.
*
* @version 0.6
* @author Scott Ryer <scott@gravitywiz.com>
* @license GPL-2.0+