Skip to content

Instantly share code, notes, and snippets.

@Lonsdale201
Lonsdale201 / code
Last active March 20, 2025 02:30
JetFormBuilder - Formless Action success reload jetengine lisitng grid with ajax
(function($) {
'use strict';
/**
* Developer note:
* This code use the native "fetch" function to intercept AJAX calls
* for the 'remoovehouuse' endpoint. When it detects a successful (HTTP 200)
* response with `{"code":"success"}`, it automatically reloads all Listing Grids
* that have the class ".formless-ajax.elementor-widget-jet-listing-grid".
* Change the .formless-ajax if you want to use different class target
@Audiovoyeur
Audiovoyeur / functions.php
Created January 10, 2025 09:37
Custom JetFormBuilder Filter for Formatting Repeater Field Output.
<?php
add_filter( 'jet-form-builder/content-filters', function( $filters ) {
// Define a custom filter class for formatting repeater field data
class Separate_With_Spaces_JFB_Filter extends \Jet_Form_Builder\Classes\Filters\Base_Filter {
// Unique ID for this filter
public function get_id(): string {
return 'separate_with_spaces';
@Lonsdale201
Lonsdale201 / code
Created December 7, 2024 00:33
JetFormBuilder - Call webhook - Call Chatgpt
// place the code in the child theme functions.php or a custom code snippets plugin like Fluent Snippts etc..
// You need to add two key in your wp-config.php
// first open your wp-config.php and define( 'OPENAI_API_KEY', 'My_Chatgpt_API');
// add a new line with your auth token: define( 'CUSTOM_API_TOKEN', 'My_auth_token');
// example token define( 'CUSTOM_API_TOKEN', 'a3f9c74d2b69a7e1bcd15e2e4fc98a6c4ed12e9985bcae439f6ad5db95f17c23');
// in the Custom api token you can enter anything
// open your functions.php or fluentsnippets and paste the code which you can find below
// open your jetformbuilder add a new webhook submission and paste your wesbite domain name like
// https://mywebsite.com/wp-json/custom-webhooks/v1/chatgpt-handler?api_token=CUSTOM_API_TOKEN
@ihslimn
ihslimn / code.php
Created May 16, 2024 13:34
Jet_Appointment_Add_Current_Link
<?php
class Jet_Appointment_Add_Current_Link {
private $query_var = 'jet_apb_add_current_to_calendar';
public function __construct() {
add_action( 'plugins_loaded', array( $this, 'add_filters' ), 1000 );
}
@Qubadi
Qubadi / gist:aedf82f9cb08070612f7e4d88ac0d70a
Created May 4, 2024 23:26
Jetformbuilder: Auto-fill and format date inputs from MM/DD/YYYY to DD/MM/YYYY
This jQuery script automatically populates the JetFormBuilder form date inputs with today's date in MM/DD/YYYY format and
updates corresponding hidden fields to the DD/MM/YYYY format upon form submission. The script ensures that the dates are
visible and considered 'selected' by the user, improving data accuracy and user experience without manual entry. It supports
multiple date fields and can easily be configured to handle various date and hidden field IDs, making it ideal for ensuring
consistent date formatting and handling across front-end displays and back-end processing.
1. Firstly, copy the custom HTML code and paste it into your snippet plugins. Create a new HTML snippet and save it as "footer".
2. Create a date field and a hidden field. Name both fields and change the IDs to your preferred IDs:
{ visible: 'YOUR DATE FIELD NAME/ID', hidden: 'YOUR HIDDEN FIELD NAME/ID' },
3. Add the hidden field name to Jetformbuilder's post-submit action (content) to display the date format as DD/MM/YY.
@Crocoblock
Crocoblock / code.php
Last active May 26, 2025 07:03
JetAppointment Redirect to custom page on appointment cancel
<?php
add_filter( 'jet-apb/public-actions/custom-action-page-content', 'jet_apb_custom_cancel_redirect', 10, 2 );
add_filter( 'jet-apb/public-actions/custom-action-page-content', 'jet_apb_custom_confirm_redirect', 10, 2 );
function jet_apb_custom_cancel_redirect( $custom, $action ) {
$type = $action->get_action();
if ( $type === 'cancel' ) {
@Crocoblock
Crocoblock / code.php
Last active February 26, 2025 03:30
JetFormBuilder Add id attribute to form
<?php
add_filter( 'jet-form-builder/before-start-form', function ( $before_form_start, $form ) {
$form->add_attribute( 'id', 'jet-form-' . $form->form_id );
return $before_form_start;
}, 0, 2 );
@Crocoblock
Crocoblock / code.html
Last active February 26, 2025 03:30
JetSmartFilters Scroll to page top on filters application
<script>
document.addEventListener('jet-smart-filters/inited', function(initEvent) {
jQuery(function($) {
window.JetSmartFilters.events.subscribe('ajaxFilters/updated', function(provider, queryId) {
setTimeout( function() {
window.scrollTo({
top: 0,
behavior: "smooth",
});
}, 10 );
@Crocoblock
Crocoblock / code.php
Last active February 26, 2025 03:31
JetEngine Dynamic Tables Filter columns (process shortcodes in column names)
<?php
add_filter( 'jet-engine/data-tables/table-columns', function( $columns ) {
foreach ( $columns as $i => $column ) {
if ( empty( $column['name'] ) ) {
continue;
}
@Crocoblock
Crocoblock / code.php
Created December 20, 2023 13:34
JetAppointment Exclude not full-duration slots
<?php
add_filter( 'jet-apb/time-slots/slots-html/slots-list', function( $slots, $format, $dataset, $date, $service, $provider ) {
$duration = jet_apb()->calendar->get_schedule_settings( $provider, $service, null, 'default_slot' );
foreach ( $slots as $time => $slot ) {
if ( $slot['to'] - $slot['from'] < $duration ) {
unset( $slots[ $time ] );
}